Allow the ability to throw custom errors from verify #203
Closed
MarcDonald
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
This is now possible with the try {
await authenticator.authenticate("strategy", request, {
throwOnError: true,
successRedirect: "/private"
})
} catch (error) {
if (error instanceof AuthorizationError) {
if (error.cause instanceof CustomErrorClass) {
// do something here
}
// or here
}
// here
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
At the moment it seems that any error thrown in the
verify
method of a strategy gets turned into anAuthorizationError
by the time it gets back to the loader/action. I would like to use a custom error that is thrown in verify and can be caught and handled separately from AuthorizationError.E.g. (pseudocode)
If this looks like complete nonsense and is a totally wrong way of thinking about how this flow should be handled please let me know what the proper way to handle it would be, thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions