PteroJS icon indicating copy to clipboard operation
PteroJS copied to clipboard

Error Abstraction

Open devnote-dev opened this issue 3 years ago • 1 comments

Abstracting errors to their own classes is a popular and common error structure in a lot of libraries and is a standard in certain programming languages like Java. Currently, PteroJS groups all API errors under PteroAPIError, following this structure we would abstract PteroAPIError and have AuthorizationError for 401/403 responses, ValidationError will extend this for 422 responses, and a series of other error classes for various parts of the API.

Thoughts?

devnote-dev avatar Dec 18 '22 15:12 devnote-dev

I agree, that would be great and better for catching (can have custom error messages)

WeeskyBDW avatar Jan 24 '23 09:01 WeeskyBDW