-
Notifications
You must be signed in to change notification settings - Fork 52
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
responseError not raised when my http get 401 UnAuthorized error #16
Comments
This is cause the native fetch library makes no assumptions about the response code if it is an error or a wanted behaviour. You can convert your response to an error and handle it afterwards. Example fetchIntercept.register({
response: function (response) {
if (response.code >= 400) throw new Error('Request error');
return response;
}
});
fetchIntercept.register({
responseError: function (error) {
// Handle your error thrown from the previous interceptor here
}
}); |
Thanks |
@mlegenhausen Hello! Can you help me? I have the same issue. I did everything that you wrote, but unfortunately, I could not handle the error in responseError. requestError: function(error) { response: function(response) { responseError: function(error) { |
You need to call |
Hello. Thank you for the answer. I did everything like you, but unfortunately, my component (showNotification) was not called in responseError for some reasons. I can't understand why. Maybe I am doing something wrong my code: fetchIntercept.register({ |
Try out to regsiter the |
@mlegenhausen awesome!!! It works. Thank you very much for quick answer. |
Why?
The text was updated successfully, but these errors were encountered: