refactor: throw common error with util function instead
This commit is contained in:
parent
68f9dc203e
commit
4de0e1da87
12 changed files with 67 additions and 142 deletions
|
|
@ -16,3 +16,11 @@ export function notFoundError(name: string) {
|
|||
`${name.charAt(0).toLowerCase() + name.replaceAll(" ", "").slice(1)}NotFound`,
|
||||
);
|
||||
}
|
||||
|
||||
export function isUsedError(name: string) {
|
||||
return new HttpError(
|
||||
HttpStatus.PRECONDITION_FAILED,
|
||||
`${name} cannot be found.`,
|
||||
`${name.charAt(0).toLowerCase() + name.replaceAll(" ", "").slice(1)}IsUsed`,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue