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
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
No error message is output in the console
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem:
No error message is output in the console:
var User = $resource('users/:id', {id: '@id'});
var user User.get({id: 123}, function (res) {
y = x + z; // this line not log any exception on the console
}, function () {
console.log(arguments);
});
Error message is output in the console:
var User = $resource('users/:id', {id: '@id'});
var user User.get({id: 123}, function (res) {
y = x + z; // and this log the exception in the console
});
What is the expected behavior?
Exception output in the console in both cases
Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Angular: 1.6.1
Chrome: 55.0.2883.87
The text was updated successfully, but these errors were encountered:
up2-date
changed the title
angular 1.6 - $resource: no exception in console
angular 1.6.1 - $resource: no exception in console
Jan 19, 2017
Argh! It's a valid issue. We are silencing Possibly Unhandled Rejection errors if an error callback is provided, but this will incorrectly silence errors in the success callback, which are never passed to the error callback.
The success/error callbacks are messy anyway and I would like to deprecate them. It is much better to use "proper" promise methods:
varuserUser.get({id: 123});user.$promise.then(onSuccess,onError);// or even// user.$promise.then(onSuccess).catch(onError);
Previously, errors thrown inside the `success` callback would be swallowed by a
noop `catch()` handler. The `catch()` handler was added in order to avoid an
unnecessary "Possibly Unhandled Rejection" error, in case the user provided an
`error` callback (which would handle request errors).
The handler was added too "eagrly" and as a result would swallow errors thrown
in the `success` callback, despite the fact that those errors would _not_ be
handled by the `error` callback.
This commit fixes this, by adding the `catch()` handler "lazily", only when it
is certain that a rejection will be handled by the `error` callback.
Fixes#15624Closes#15628
ellimist
pushed a commit
to ellimist/angular.js
that referenced
this issue
Mar 15, 2017
Previously, errors thrown inside the `success` callback would be swallowed by a
noop `catch()` handler. The `catch()` handler was added in order to avoid an
unnecessary "Possibly Unhandled Rejection" error, in case the user provided an
`error` callback (which would handle request errors).
The handler was added too "eagrly" and as a result would swallow errors thrown
in the `success` callback, despite the fact that those errors would _not_ be
handled by the `error` callback.
This commit fixes this, by adding the `catch()` handler "lazily", only when it
is certain that a rejection will be handled by the `error` callback.
Fixesangular#15624Closesangular#15628
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
bug
What is the current behavior?
No error message is output in the console
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem:
No error message is output in the console:
Error message is output in the console:
What is the expected behavior?
Exception output in the console in both cases
Which versions of Angular, and which browser / OS are affected by this issue? Did this work in previous versions of Angular? Please also test with the latest stable and snapshot (https://code.angularjs.org/snapshot/) versions.
Angular: 1.6.1
Chrome: 55.0.2883.87
The text was updated successfully, but these errors were encountered: