From e4bd3006f46d68edd7a8961182a11a1f9fd6691e Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Tue, 22 Oct 2024 16:15:31 -0400 Subject: [PATCH] cleanup our responses --- openapi.yaml | 2 ++ src/handlers/CreateEntity/function.ts | 5 ++++- src/handlers/DeleteEntity/function.ts | 5 ++++- src/handlers/GetEntity/function.ts | 5 ++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index 5ad9a81..63a2747 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -319,6 +319,8 @@ components: ErrorResponse: type: object properties: + name: + type: string message: type: string required: diff --git a/src/handlers/CreateEntity/function.ts b/src/handlers/CreateEntity/function.ts index 8aa64c8..15c81fd 100644 --- a/src/handlers/CreateEntity/function.ts +++ b/src/handlers/CreateEntity/function.ts @@ -89,7 +89,10 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise statusCode = 500 break; } - body = JSON.stringify({message: (error).message}) + body = JSON.stringify({ + name: (error).name, + message: (error).message + }) } diff --git a/src/handlers/DeleteEntity/function.ts b/src/handlers/DeleteEntity/function.ts index e4bd86f..6036f69 100644 --- a/src/handlers/DeleteEntity/function.ts +++ b/src/handlers/DeleteEntity/function.ts @@ -78,7 +78,10 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise statusCode = 500 break; } - body = JSON.stringify({message: (error).message}) + body = JSON.stringify({ + name: (error).name, + message: (error).message + }) } return { diff --git a/src/handlers/GetEntity/function.ts b/src/handlers/GetEntity/function.ts index 3f1f416..e804480 100644 --- a/src/handlers/GetEntity/function.ts +++ b/src/handlers/GetEntity/function.ts @@ -90,7 +90,10 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise statusCode = 500 break; } - body = JSON.stringify({message: (error).message}) + body = JSON.stringify({ + name: (error).name, + message: (error).message + }) } return {