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
I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
I have my custom way to handle errors depending on their type. I know that by using verifyBearerAuth there are 2 types of errors that can be thrown and I have a custom way to handle booth cases separately. But now I cannot check if the error is an FST_BEARER_AUTH_INVALID_AUTHORIZATION_HEADER or an FST_BEARER_AUTH_MISSING_AUTHORIZATION_HEADER because none of them is exported
Motivation
Handling errors a custom way.
Example
if(error instanceof FST_BEARER_AUTH_MISSING_AUTHORIZATION_HEADER) {
// handle missing authorization header
} else if (error instance of FST_BEARER_AUTH_INVALID_AUTHORIZATION_HEADER) {
// handle invalid token
} else {
// Probably a 500 error or any you have defined
}
The text was updated successfully, but these errors were encountered:
If somebody wants all Fastify core errors, they can do err.code?.indexOf('FST_') === 0.
But that doesn't really help with errorResponse especialy with typescript when the type of the error is Error and property code does not exist on this type
Prerequisites
🚀 Feature Proposal
I have my custom way to handle errors depending on their type. I know that by using
verifyBearerAuth
there are 2 types of errors that can be thrown and I have a custom way to handle booth cases separately. But now I cannot check if the error is anFST_BEARER_AUTH_INVALID_AUTHORIZATION_HEADER
or anFST_BEARER_AUTH_MISSING_AUTHORIZATION_HEADER
because none of them is exportedMotivation
Handling errors a custom way.
Example
The text was updated successfully, but these errors were encountered: