chore: add more helper function

This commit is contained in:
Methapon Metanipat 2024-09-10 16:41:40 +07:00
parent acdbef485a
commit cf4d3a9967

View file

@ -8,3 +8,11 @@ export function throwRelationError(name: string) {
`relation${name.replaceAll(" ", "")}NotFound`,
);
}
export function throwNotFound(name: string) {
throw new HttpError(
HttpStatus.BAD_REQUEST,
`${name} cannot be found.`,
`${name.charAt(0).toLowerCase() + name.replaceAll(" ", "").slice(1)}NotFound`,
);
}