-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix($http): throw error if success and error methods do not receive a fu... #11333
Conversation
@IgorMinar - can you review and merge this if you feel it appropriate? |
d894e54
to
434dbd8
Compare
This sound like a sensible approach to me but we don't do much of this kind of defensive programming in other places. Anyway, if it saves people time, why not merging it. |
The patch itself looks good to me. |
The other option would be adding |
If we want to stick to the A+ spec then we should ignore non-function callbacks: https://promisesaplus.com/#point-23 |
Hold on! This is about the custom The complaint is that the developer error of not defining the function before using it is currently difficult to debug. Ignoring such errors will make it even more difficult to debug what is going on. At least, right now, we get an error telling us that there is "something" wrong but that the error message is too vague. |
@petebacondarwin I know, I've brought promises because of this comment |
This pr looks good to me. I can't imagine that the spec authors would want what looks like a programing error to be intentionally silenced. Since the CI is green I assume that aplus spec passes, in which case I'd say let's merge it in. I would however make a note of of the changed behavior in the commit (and maybe even consider this as a breaking change) since people that made errors in the past will now get unexpected exceptions after the upgrade. Even if we consider this to be a breaking change, I think we should merge it into the stable branch. |
|
Actually, there is no breaking change. The exception would still occur before, it is just that the error message was more vague as it happened asynchronously. |
…ve a function Closes angular#11330 Closes angular#11333
434dbd8
to
1af563d
Compare
…ve a function Closes angular#11330 Closes angular#11333
Has this changed it so you have to define both a success and error function? Upgrading from 1.3.15 breaks my previously unbroken app for everywhere I chose not to handle the error method. It's also not easy to debug as I'm not getting any stacktrace outside of the angular library. |
@toxaq no - this only affects the |
@petebacondarwin you're right, I just realised it's a byproduct of the way I've written my services. Sorry for the bother. |
...nction
Closes #11330