PteroJS
PteroJS copied to clipboard
Error Abstraction
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?
I agree, that would be great and better for catching (can have custom error messages)