-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Cannot call method 'then' of undefined" when specifying an invalid .catch filter #318
Comments
You are right, I think it should just throw synchronously |
Not sure I'm particularly fond of the idea of this promise returning function throwing synchronously. However, it's consistent with what the promise constructor does and it's a core library method rather than an API. |
Noooooooo |
Domenic it's very comparabale to syntaxerror, like you would never have a runtime dynamic value as a catch predicate. Or would you? |
You very well could, e.g. I could imagine some form validation code composing its filter. In general It should just return a promise rejected with a |
I've written the following code (Coffeescript):
... and I made the mistake of trying to filter by
req.db.EmptyResponse
(which wasundefined
) rather than by the correct attributereq.db.EmptyError
. However, bluebird didn't remark on me passingundefined
as filter - instead, it gave me the following error:This refers to the
.then
call in line 5 of the code snippet above. Instead of throwing a fairly cryptic error (why does.catch
returnundefined
?), it should probably throw an error of some sort that the specified filter is invalid - after all, it's not anError
type nor a function.The text was updated successfully, but these errors were encountered: