ember-ajax
ember-ajax copied to clipboard
Create base Error class for HTTP errors
It would be useful with an isHttpError(myError) function, which would essentially be everything that isn't timeout or aborted. Would you be open to adding something like that?
Yeah, I don't see a problem there. Is a 'timeout' really not an HTTP error? Honest question, I don't know the answer to that. I totally see how 'aborted' would not be one.
It's not an HTTP error in the sense that there is no HTTP status code (20x, 40x, etc). Timeouts occur in the TCP layer (connection timeouts, read timeouts) and there is no HTTP response body available.
Hmm, makes sense. If you'd like to make a PR to add this helper function, I'm happy to review it!
@alexlafroscia Given the plan to (probably) phase out the helpers in favour of instanceOf checks, it would make sense to add an intermediary class in the error hierarchy.
EmberError > AjaxError > HttpError > InvalidError // new
EmberError > AjaxError > HttpError > BadRequestError // new
EmberError > AjaxError > TimeoutError // unchanged
Just want to check if you're open to that too?
Totally, I think that's a great idea!