found problem in angular. js : Code snippet below extracted from
angular.js. They do change a 0 to a 404 !
function completeRequest(callback, status, response, headersString) {
// cancel timeout and subsequent timeout promise resolution
timeoutId && $browserDefer.cancel(timeoutId);
jsonpDone = xhr = null;
// fix status code when it is 0 (0 status is undocumented).
// Occurs when accessing file resources.
// On Android 4.1 stock browser it occurs while retrieving
files from application cache.
status = (status === 0) ? (response ? 200 : 404) : status;
// normalize IE bug (http://bugs.jquery.com/ticket/1450)
status = status == 1223 ? 204 : status;
callback(status, response, headersString);
$browser.$$completeOutstandingRequest(noop);
}
Chuck
On Wednesday, January 29, 2014 2:54:43 PM UTC-6, Chuck Fillet wrote:
>
> I am also experiencing this problem. My angular verison is 1.2.9. I have
> put my client in airplane mode and it returns a 404 as a result of a rest
> call using $http.
>
> Chuck
>
> On Wednesday, January 29, 2014 7:00:42 AM UTC-6, Geir Gullestad Pettersen
> wrote:
>>
>> I'm using AngularJS for a singlepage app with a REST backend. It should
>> handle networking issues gracefully so I had the following code running on
>> 1.2.2:
>>
>> $http(...).success(function (data, status, headers, config) {
>>
>> // do success stuff
>>
>> })
>> .error(function (data, status, headers, config) {
>>
>> if (status == 0) {
>> // handle lower level communication issue, e.g.
>> ask user to check network setup, etc and try again
>> }
>> else {
>> // handle 40x errors (user was not authorized,
>> referenced a resources that doesn't exist, etc)
>> }
>> });
>>
>>
>> When i was on 1.2.2 the status was 0 whenever the server was down. i
>> could then display a message to the user that he had networking issues
>> (possibly disconnected wlan, mobile data, etc).
>>
>> However, after upgrading to 1.2.10 i get status 404 when there are
>> communication issues, instead of 0 as before.
>>
>> Is this intentional or a bug? If it is intentional it makes it a lot
>> harder for to distinguish between network layer errors and application
>> errors since 404 is also used by the REST interface to report resources
>> that doesnt exist.
>>
>> Any thoughts?
>>
>> Thanks!
>>
>>
>> /Geir
>>
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.