We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 77ddbdd commit 2dffb63Copy full SHA for 2dffb63
1 file changed
lambdas/api-handler/src/mappers/error-mapper.ts
@@ -15,6 +15,9 @@ export function mapErrorToResponse(error: unknown, correlationId: string | undef
15
} else if (error instanceof NotFoundError) {
16
logger.info({ err: error }, `Not found error correlationId=${correlationId}`);
17
return buildResponseFromErrorCode(ApiErrorCode.NotFound, error.detail, correlationId);
18
+ } else if (error instanceof Error) {
19
+ logger.error({ err: error }, `Internal server error correlationId=${correlationId}`);
20
+ return buildResponseFromErrorCode(ApiErrorCode.InternalServerError, "Unexpected error", correlationId);
21
} else {
22
logger.error({ err: error }, `Internal server error (non-Error thrown) correlationId=${correlationId}`);
23
return buildResponseFromErrorCode(ApiErrorCode.InternalServerError, "Unexpected error", correlationId);
0 commit comments