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
According to the documentation remote-url-error-callback parameter defines a user function which is supposed to be called when AJAX error happens. However, this function is called only for cases when the server returns a error code (for example, 404 Not Found, or 500 Internal Server Error). But there are also other types of network errors, when the callback function is not fired, I tested the following cases (probably there are more):
Invalid domain name (the browser couldn't resolve the domain name = domain name not found)
HTTP timeout (the server didn't respond)
CORS error (the origin is not allowed by Access-Control-Allow-Origin)
The call to user defined callback function is ignored, because of the following code:
functionhttpErrorCallback(errorRes,status,headers,config){scope.searching=httpCallInProgress;// normalize return obejct from promiseif(!status&&!headers&&!config){status=errorRes.status;}// cancelled/abortedif(status===0||status===-1){return;}
It checks that error status code should not be 0 and -1. However, for all network errors (such as I mentioned above), when the HTTP status code couldn't be obtained from the server because the connection failed, the status will be -1.
It's not documented in AngularJS how to validate that the request was aborted/cancelled or it actually failed:
A response status code between 200 and 299 is considered a success status and will result in the success callback being called. Any response status code outside of that range is considered an error status and will result in the error callback being called. Also, status codes less than -1 are normalized to zero. -1 usually means the request was aborted, e.g. using a config.timeout
For example, in jQuery such situation is well documented:
Possible values for the textStatus argument (besides null) are "timeout", "error", "abort", and "parsererror". When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error."
I think that the user callback function should be called in any case.
The text was updated successfully, but these errors were encountered:
According to the documentation remote-url-error-callback parameter defines a user function which is supposed to be called when AJAX error happens. However, this function is called only for cases when the server returns a error code (for example, 404 Not Found, or 500 Internal Server Error). But there are also other types of network errors, when the callback function is not fired, I tested the following cases (probably there are more):
The call to user defined callback function is ignored, because of the following code:
It checks that error status code should not be 0 and -1. However, for all network errors (such as I mentioned above), when the HTTP status code couldn't be obtained from the server because the connection failed, the status will be -1.
It's not documented in AngularJS how to validate that the request was aborted/cancelled or it actually failed:
For example, in jQuery such situation is well documented:
I think that the user callback function should be called in any case.
The text was updated successfully, but these errors were encountered: