2024-09-10 14:19:16 +07:00
|
|
|
import HttpError from "../interfaces/http-error";
|
|
|
|
|
import HttpStatus from "../interfaces/http-status";
|
|
|
|
|
|
2024-09-11 14:38:26 +07:00
|
|
|
export function relationError(name: string) {
|
|
|
|
|
return new HttpError(
|
2024-09-10 14:19:16 +07:00
|
|
|
HttpStatus.BAD_REQUEST,
|
|
|
|
|
`${name} cannot be found.`,
|
|
|
|
|
`relation${name.replaceAll(" ", "")}NotFound`,
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-09-10 16:41:40 +07:00
|
|
|
|
2024-09-11 14:38:26 +07:00
|
|
|
export function notFoundError(name: string) {
|
|
|
|
|
return new HttpError(
|
2024-09-10 16:41:40 +07:00
|
|
|
HttpStatus.BAD_REQUEST,
|
|
|
|
|
`${name} cannot be found.`,
|
|
|
|
|
`${name.charAt(0).toLowerCase() + name.replaceAll(" ", "").slice(1)}NotFound`,
|
|
|
|
|
);
|
|
|
|
|
}
|