-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: exceptionHandler #276
base: main
Are you sure you want to change the base?
Conversation
This PR will trigger a minor release when merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To put things in a larger perspective:
@@ -66,11 +66,11 @@ export const createKeyEvent = (data) => { | |||
} | |||
|
|||
if (!Object.values(KEY_EVENT_TYPES).includes(newState.type.toUpperCase())) { | |||
throw new Error(`Unknown value for "type": ${newState.type}`); | |||
throw new ClientError(`Unknown value for "type": ${newState.type}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ClientErrors are not only validation errors, where we return 400. They can be all 400-499 status codes.
If we want a quick fix, I recommend adding proper try-catch return badRequest in the key events controller.
If we want a long-term pattern, we should address main types of client errors with the corresponding status code.
Please ensure your pull request adheres to the following guidelines:
Related Issues
Thanks for contributing!