Andriy Drozdyuk
Andriy Drozdyuk

Reputation: 61041

Prevent AngularJs from outputting GET error messages to console?

When I write $http.get request, even if I provide an error handling function:

function Ctrl1($scope, $http){
 $http.get('www.blahNonexistent.com/api').
 success(
     function(data){console.log("SUCCESS");}
 ).
 error(
     function(data){console.log("ERROR");}
 )
}

AngularJs still outputs the error to the console:

enter image description here

Here is a minimal working example on JsFiddle.

Is there any way to prevent this behavior? (I don't want the use the think the site is broken, if one of the API endpoints is down)

Upvotes: 2

Views: 968

Answers (1)

bmleite
bmleite

Reputation: 26880

That's a native error message and not an angularjs error, therefore I don't think you can "disable"/prevent it.

For example, if you add the following css to your fiddle, you will get the same GET error on the console:

div {
    background-image: url("image.png");
}

Upvotes: 3

Related Questions