1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/error/exceeds-limit-error.ts
Gastón Fournier feb6825023
chore: add a generic error for limit's exeeded (#6452)
## 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:
2d8e9f87ff/src/lib/error/unleash-error.ts (L4-L34)
2024-03-06 19:17:31 +01:00

12 lines
388 B
TypeScript

import { GenericUnleashError } from './unleash-error';
export class ExceedsLimitError extends GenericUnleashError {
constructor(resource: string, limit: number) {
super({
name: 'ExceedsLimitError',
message: `Failed to create ${resource}. You can't create more than the established limit of ${limit}.`,
statusCode: 400,
});
}
}