From 6433ccd750af25fc163cde4cd6406874bec3a68a Mon Sep 17 00:00:00 2001 From: jeffvli Date: Wed, 12 Oct 2022 13:47:11 -0700 Subject: [PATCH] Set error message optional --- src/server/utils/api-error.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/server/utils/api-error.ts b/src/server/utils/api-error.ts index a31f5f0bb..b02e45b00 100644 --- a/src/server/utils/api-error.ts +++ b/src/server/utils/api-error.ts @@ -8,37 +8,37 @@ export class ApiError extends Error { this.statusCode = options.statusCode; } - static badRequest(message: string) { + static badRequest(message?: string) { return new ApiError({ message: message || 'Bad request.', statusCode: 400, }); } - static unauthorized(message: string) { + static unauthorized(message?: string) { return new ApiError({ message: message || 'Unauthorized.', statusCode: 401, }); } - static forbidden(message: string) { + static forbidden(message?: string) { return new ApiError({ message: message || 'Forbidden.', statusCode: 403 }); } - static notFound(message: string) { + static notFound(message?: string) { return new ApiError({ message: message || 'Not found.', statusCode: 404 }); } - static conflict(message: string) { + static conflict(message?: string) { return new ApiError({ message: message || 'Conflict.', statusCode: 409 }); } - static gone(message: string) { + static gone(message?: string) { return new ApiError({ message: message || 'Gone.', statusCode: 410 }); } - static internal(message: string) { + static internal(message?: string) { return new ApiError({ message: message || 'Internal error.', statusCode: 500,