Skip to content

Commit

Permalink
cleanup our responses
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclaugh committed Oct 22, 2024
1 parent 5d03df1 commit e4bd300
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ components:
ErrorResponse:
type: object
properties:
name:
type: string
message:
type: string
required:
Expand Down
5 changes: 4 additions & 1 deletion src/handlers/CreateEntity/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise
statusCode = 500
break;
}
body = JSON.stringify({message: (<Error>error).message})
body = JSON.stringify({
name: (<Error>error).name,
message: (<Error>error).message
})
}


Expand Down
5 changes: 4 additions & 1 deletion src/handlers/DeleteEntity/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise
statusCode = 500
break;
}
body = JSON.stringify({message: (<Error>error).message})
body = JSON.stringify({
name: (<Error>error).name,
message: (<Error>error).message
})
}

return {
Expand Down
5 changes: 4 additions & 1 deletion src/handlers/GetEntity/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ export async function handler (event: APIGatewayProxyEvent, _: Context): Promise
statusCode = 500
break;
}
body = JSON.stringify({message: (<Error>error).message})
body = JSON.stringify({
name: (<Error>error).name,
message: (<Error>error).message
})
}

return {
Expand Down

0 comments on commit e4bd300

Please sign in to comment.