-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Description
Library throws errors of generic TypeError without any additional information attached to them. It makes it almost impossible to distinguish them from TypeErrors thrown by any other piece of code. The only option is to try to parse error messages, which is not convenient and unreliable, cuz they seem like not something that is part of the library API contract. Could you please add custom error class like this?
export class JSONTypeError extends TypeError { // Custom class makes it possible to differentiate errors thrown by this library
constructor(message) {
super(message)
this.code = 'FAILED_TO_PARSE_JSON' // Optionally, may make sense to attach some sort of error code in order to differentiate it without using `instanceof` operator
}
}Metadata
Metadata
Assignees
Labels
No labels