-
-
Notifications
You must be signed in to change notification settings - Fork 656
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
chore: add a generic error for limit's exeeded #6452
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
src/lib/error/exeeds-limit-error.ts
Outdated
export class ExeedsLimitError extends GenericUnleashError { | ||
constructor(resource: string, limit: number) { | ||
super({ | ||
name: 'ValidationError', // it can also be 'OperationDeniedError' or we can create a new one |
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.
Why not call it ExceedsLimitError
?
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.
I did, let's see how it goes :D
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.
I think this is a good starting point! Still, I think it's worth taking the comments into consideration before merging it.
About the changes
We don't have a meaningful error for limits established by the application. This could be a good starting point.
The error code is 400 cause I couldn't find anything better.
The name of the error was picked from UnleashApiErrorTypes:
unleash/src/lib/error/unleash-error.ts
Lines 4 to 34 in 2d8e9f8