feat: add more helper function
This commit is contained in:
parent
771f1a1c58
commit
f9cc39522c
2 changed files with 16 additions and 0 deletions
10
src/utils/error.ts
Normal file
10
src/utils/error.ts
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
||||
export function throwRelationError(name: string) {
|
||||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
`${name} cannot be found.`,
|
||||
`relation${name.replaceAll(" ", "")}NotFound`,
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue