Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

HTTP Response with status 500 still gets the .success function executed #4419

@aruizca

Description

@aruizca

Using Angularjs version 1.0.8 and 1.0.7

I have this function and at server side I just added an unchecked exception to see if my AngularJS code handles server side errors when performing Ajax request using the $http service:

this.save = function(formData, successCallback, baseRelativeUrl) {
    $http.post(baseRelativeUrl + '/save', formData)
        .success(function (data, status, headers, config) {
            successCallback(data);
        })
        .error (function (data, status, headers, config) {
            $rootScope.$emit('displayAlerts', [{type: 'error', msg: 'There was a server side error'}]);
        });
};

Despite the response status code being 500, the success function is being executed and the error function ignored.

Thank in advance for your help!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions