Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

catch exceptions from handlers

  • Loading branch information...
commit b71ec944139946bf6e2d246e74ca0488e9815af8 1 parent ee3a91f
@Floby authored
Showing with 6 additions and 1 deletion.
  1. +6 −1 lib/Parser.js
View
7 lib/Parser.js
@@ -101,7 +101,12 @@ Parser.prototype._newToken = function _newToken(token, type) {
}
// actually call the handler. the scope is the parser
- expand = f.call(this, token, type, next);
+ try {
+ expand = f.call(this, token, type, next);
+ } catch(e) {
+ this.emit('error', e);
+ expand = false;
+ }
} while(expand === true) // the handler is expandable, let's roll again
// too bad that was the end of it...

0 comments on commit b71ec94

Please sign in to comment.
Something went wrong with that request. Please try again.