Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4830

Error being logged even though it has been handled

$
0
0

@NicolasPinzon wrote:

I'm querying my express backend and if the item is not found it returns a jsonapi formatted error:

res.send({errors:[{status:404,title:'item not found'}]});

I don't set a 4xx status on the response to avoid getting an error logged on the console. I changed the adapter to handle this type of errors by overriding isSuccess method:

isSuccess (status, headers, payload){
    return payload.errors === undefined;
}

But an additional error is being logged:

Error: Ember Data Request GET http://localhost:3000/products/query returned a 200
Payload (application/json; charset=utf-8)
[object Object]
at new Error (native)
at Error.EmberError (http://localhost:4200/assets/vendor.js:29816:21)
at Error.AdapterError (http://localhost:4200/assets/vendor.js:84679:16)
at Class.handleResponse (http://localhost:4200/assets/vendor.js:85956:14)
at Class.hash.success (http://localhost:4200/assets/vendor.js:86020:34)
at fire (http://localhost:4200/assets/vendor.js:3499:31)
at Object.fireWith [as resolveWith] (http://localhost:4200/assets/vendor.js:3629:7)
at done (http://localhost:4200/assets/vendor.js:9069:14)
at XMLHttpRequest.<anonymous> (http://localhost:4200/assets/vendor.js:9435:9)

How do I disable logging for these type of errors?

Posts: 5

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles