Skip to content

Commit

Permalink
Only add assertion messages on failure.
Browse files Browse the repository at this point in the history
Adding assertion messages when missing was slowing down the code
because of the repeated throwing at catching of exceptions.  Now
only add a stack trace if the assertion will fail.

Issue #288

Change-Id: Ic4ec3180df0178f1e3e0b25534d9e5bb018707a4
  • Loading branch information
TheModMaker authored and joeyparrish committed Feb 27, 2016
1 parent 96bf5b2 commit 1d64c7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/debug/asserts.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ if (shaka.asserts.ENABLE_ASSERTS) {

shaka.asserts.assert = function(test, opt_message) {
var message = opt_message;
if (!message) {
if (!test && !message) {
// IE11 does not display any stack information on assertions. So if
// there is no message, create one from the stack.
try {
Expand Down

0 comments on commit 1d64c7d

Please sign in to comment.