refactor: helper function manual throw
This change is to prevent swagger to infer empty type from return type
This commit is contained in:
parent
5b9472b466
commit
4da867cde1
4 changed files with 22 additions and 22 deletions
|
|
@ -1,16 +1,16 @@
|
|||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
||||
export function throwRelationError(name: string) {
|
||||
throw new HttpError(
|
||||
export function relationError(name: string) {
|
||||
return new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
`${name} cannot be found.`,
|
||||
`relation${name.replaceAll(" ", "")}NotFound`,
|
||||
);
|
||||
}
|
||||
|
||||
export function throwNotFound(name: string) {
|
||||
throw new HttpError(
|
||||
export function notFoundError(name: string) {
|
||||
return new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
`${name} cannot be found.`,
|
||||
`${name.charAt(0).toLowerCase() + name.replaceAll(" ", "").slice(1)}NotFound`,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue