Skip to content

Commit 2dffb63

Browse files
committed
Fix logging in error mapper
1 parent 77ddbdd commit 2dffb63

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lambdas/api-handler/src/mappers/error-mapper.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ export function mapErrorToResponse(error: unknown, correlationId: string | undef
1515
} else if (error instanceof NotFoundError) {
1616
logger.info({ err: error }, `Not found error correlationId=${correlationId}`);
1717
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);
1821
} else {
1922
logger.error({ err: error }, `Internal server error (non-Error thrown) correlationId=${correlationId}`);
2023
return buildResponseFromErrorCode(ApiErrorCode.InternalServerError, "Unexpected error", correlationId);

0 commit comments

Comments
 (0)