noblox/noblox.js

[FEATURE] Global error class

Closed this issue · 0 comments

Right now each method has its own error parser (if any). Apart from it being very repetitive, it does not work for certain error responses (i.e those not contained within an errors array).

I would like to move this to a class so that we're not reimplementing an error parser for every method.

Ideally, this class would:

  • Handle most known error responses (i.e what the current parsers can handle, csrf errors, and certain 5xx errors that don't return a proper response body)
  • Expose properties containing the status code and original response body

(If we're going to be honest this is more of an RFC)

This would probably be a v5 release target given that it could be breaking in some cases (could be pushed back).