Skip to content
Browse files

reworked/reduced the 'emit' error handling method to throw compatible…

… 'Error' exceptions and removed 'global.status' output (IE<8); slightly reduced code in 'configure' method
  • Loading branch information...
1 parent cdbb658 commit d5f1005646e2825efaf06534a4515b84726d99e5 @dperini committed Nov 29, 2012
Showing with 10 additions and 28 deletions.
  1. +5 −14 src/nwmatcher-base.js
  2. +5 −14 src/nwmatcher.js
View
19 src/nwmatcher-base.js
@@ -194,11 +194,8 @@
selectResolvers = { };
}
}
- if (Config.SIMPLENOT) {
- reValidator = RegExp(standardValidator, 'g');
- } else {
- reValidator = RegExp(extendedValidator, 'g');
- }
+ reValidator = RegExp(Config.SIMPLENOT ?
+ standardValidator : extendedValidator, 'g');
return true;
},
@@ -213,15 +210,9 @@
emit =
function(message) {
- message = 'SYNTAX_ERR: ' + message + ' ';
- if (Config.VERBOSITY) {
- throw SyntaxError(message);
- } else {
- if (global.console && global.console.log) {
- global.console.log(message);
- } else {
- global.status += message;
- }
+ if (Config.VERBOSITY) { throw Error(message); }
+ if (global.console && global.console.log) {
+ global.console.log(message);
}
},
View
19 src/nwmatcher.js
@@ -818,26 +818,17 @@
Config[i] = !!option[i] && NATIVE_QSAPI;
}
}
- if (Config.SIMPLENOT) {
- reValidator = new RegExp(standardValidator, 'g');
- } else {
- reValidator = new RegExp(extendedValidator, 'g');
- }
+ reValidator = new RegExp(Config.SIMPLENOT ?
+ standardValidator : extendedValidator, 'g');
return true;
},
// control user notifications
emit =
function(message) {
- message = 'SYNTAX_ERR: ' + message + ' ';
- if (Config.VERBOSITY) {
- throw new SyntaxError(message);
- } else {
- if (global.console && global.console.log) {
- global.console.log(message);
- } else {
- global.status += message;
- }
+ if (Config.VERBOSITY) { throw new Error(message); }
+ if (global.console && global.console.log) {
+ global.console.log(message);
}
},

0 comments on commit d5f1005

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