Skip to content

Commit

Permalink
feat(handler): ignore if error code or name does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jlenon7 committed Nov 20, 2024
1 parent 65eac6d commit 5cef705
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@athenna/http",
"version": "5.4.0",
"version": "5.5.0",
"description": "The Athenna Http server. Built on top of fastify.",
"license": "MIT",
"author": "João Lenon <[email protected]>",
Expand Down
4 changes: 3 additions & 1 deletion src/handlers/HttpExceptionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export class HttpExceptionHandler {
public async handle({ error, response }: ErrorContext): Promise<void> {
const body: any = {
statusCode: Json.copy(error.statusCode) || Json.copy(error.status) || 500,
code: String.toSnakeCase(error.code || error.name).toUpperCase(),
code: String.toSnakeCase(
error.code || error.name || 'E_INTERNAL_SERVER'
).toUpperCase(),
name: Json.copy(error.name),
message: Json.copy(error.message),
details: Json.copy(error.details),
Expand Down

0 comments on commit 5cef705

Please sign in to comment.