Skip to content

Commit 4090913

Browse files
authored
Merge pull request #214 from AthennaIO/develop
chore(handler): never pretiffy error object when using json formatter
2 parents 31008d3 + fd8eb11 commit 4090913

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@athenna/http",
3-
"version": "5.28.0",
3+
"version": "5.29.0",
44
"description": "The Athenna Http server. Built on top of fastify.",
55
"license": "MIT",
66
"author": "João Lenon <[email protected]>",

src/handlers/HttpExceptionHandler.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@ export class HttpExceptionHandler {
7171
error = error.toAthennaException()
7272
}
7373

74+
const isUsingJsonFormatter = Config.is(
75+
'logging.channels.exception.formatter',
76+
'json'
77+
)
78+
79+
if (isUsingJsonFormatter) {
80+
Log.channelOrVanilla('exception').error(error)
81+
82+
return
83+
}
84+
7485
Log.channelOrVanilla('exception').error(await error.prettify())
7586
}
7687

0 commit comments

Comments
 (0)