You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bgdavidx edited this page Aug 10, 2015
·
3 revisions
Error: Catch filter must inherit from Error or be a simple predicate function
Bluebird supports typed and predicate .catch calls. However in order to use the typed/predicate catch syntax for error handling you must do one of two things.
Pass it a constructor that inherits from Error:
}).catch(ReferenceError, function(e) { // this is fine
}).catch(Array, function(e) { // arrays don't capture stack traces
This is to enable better stack trace support and to have more consistent and logical code.
Alternatively, if you provide it a predicate be sure it's a simple function:
}).catch(function(e){ return false; }, function(e) { // this catches nothing
}).catch(function(e){ return e.someProp == 5; }, function(e) { // this is fine