javascript - Is it possible to prevent specific exceptions from being thrown? -
is there way 'whitelist' - or prevent - specific errors being thrown in try catch block?
for instance, have exception know , don't want log. however, want catch other errors pop in try/catch block.
this best can come with:
try { ... } catch(exception) { //loop through predefined list of known errors want ignore. (var in whitelistoferrors) { //if our exception matches error want ignore, //don't throw if (exception == whitelistoferrors[i]) break; //if our exception doesn't match error want ignore, //throw if (i = whitelistoferrors.length) throw exception; } } (or replace logic method searches array you, if exists)
Comments
Post a Comment