You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The library throws TypeError on various occasions, eg: TypeError: "pkcs8" must be PKCS#8 formatted string. It's quite hard to react to or to avoid these reliably.
Either I have to catch all TypeErrors, which is too broad and I have to resort to message matching to narrow it.
Or I have to prevent these TypeErrors, which means I have to known all the situations they can be thrown and reimplement the same validation logic in my client code.
Both of those solutions are fragile and rely on implementation details.
Would it be possible to change these to JOSEError or something like that? Ideally, each with own code, so they can be mapped to end user messages.
Just to be clear I don't mind generic TypeError/Error for actual "type" errors / programmatic mistakes - using number in place of object, object having wrong shape etc.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
The library throws TypeError on various occasions, eg:
TypeError: "pkcs8" must be PKCS#8 formatted string
. It's quite hard to react to or to avoid these reliably.Either I have to catch all TypeErrors, which is too broad and I have to resort to message matching to narrow it.
Or I have to prevent these TypeErrors, which means I have to known all the situations they can be thrown and reimplement the same validation logic in my client code.
Both of those solutions are fragile and rely on implementation details.
Would it be possible to change these to
JOSEError
or something like that? Ideally, each with own code, so they can be mapped to end user messages.Just to be clear I don't mind generic TypeError/Error for actual "type" errors / programmatic mistakes - using number in place of object, object having wrong shape etc.
Beta Was this translation helpful? Give feedback.
All reactions