From 762a6f487c06d349ecb144e9be5d315af7691828 Mon Sep 17 00:00:00 2001 From: Riccardo Mura Date: Fri, 18 Oct 2024 14:00:55 +0200 Subject: [PATCH] Add property to error objects --- src/plugins/error-handling.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/error-handling.ts b/src/plugins/error-handling.ts index 97c3269..069a78e 100644 --- a/src/plugins/error-handling.ts +++ b/src/plugins/error-handling.ts @@ -10,7 +10,8 @@ function mapFastifyErrorToErrorSchemaType( return { status: error.statusCode ?? HttpStatusCodes.InternalServerError, type: error.name, - detail: error.message + detail: error.message, + code: error.code // errors: // error.validation !== undefined // ? error.validation.map((validationError) => ({