26 lines
735 B
TypeScript
26 lines
735 B
TypeScript
import HttpError from "../interfaces/http-error";
|
|
import HttpStatus from "../interfaces/http-status";
|
|
|
|
export function relationError(name: string) {
|
|
return new HttpError(
|
|
HttpStatus.BAD_REQUEST,
|
|
`${name} cannot be found.`,
|
|
`relation${name.replaceAll(" ", "")}NotFound`,
|
|
);
|
|
}
|
|
|
|
export function notFoundError(name: string) {
|
|
return new HttpError(
|
|
HttpStatus.NOT_FOUND,
|
|
`${name} cannot be found.`,
|
|
`${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`,
|
|
);
|
|
}
|