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

Catching JSONAPIAdapter parse exception

$
0
0

@cah_danmonroe wrote:

I’m trying to catch an error globally and trying to find the best place to do it. If we do any rest requests (saves, create, etc) and an error occurs on the backend, the backend we use redirects to a HTML “Oops” page. Now the response is straight HTML and our adapter doesn’t like it. It throws a

SyntaxError: Unexpected token < in JSON at position 0
    at parse (<anonymous>)
    at ajaxConvert (https://localhost:4200/cmr/assets/vendor.js:21239:19)
    at done (https://localhost:4200/cmr/assets/vendor.js:21707:15)
    at XMLHttpRequest.<anonymous> (https://localhost:4200/cmr/assets/vendor.js:22000:9)
    at FakeRequest.<anonymous> (https://localhost:4200/cmr/assets/vendor.js:78060:18)
    at FakeRequest.dispatchEvent (https://localhost:4200/cmr/assets/vendor.js:78104:24)
    at dispatchEvent (https://localhost:4200/cmr/assets/vendor.js:78656:17)
    at XMLHttpRequest.xhr.(anonymous function) (https://localhost:4200/cmr/assets/vendor.js:78666:9)

in the console. I’m trying to catch this in the JSONAPIAdapter with handleResponse but it blows up before it gets to it. Where can I catch this?

Thanks, Dan

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4836

Trending Articles