fix(server): log named error details
This commit is contained in:
parent
c529529f84
commit
d54b70d18a
1 changed files with 6 additions and 0 deletions
|
|
@ -56,8 +56,14 @@ export namespace Server {
|
||||||
const app = new Hono()
|
const app = new Hono()
|
||||||
return app
|
return app
|
||||||
.onError((err, c) => {
|
.onError((err, c) => {
|
||||||
|
const msg = err instanceof Error ? err.message : String(err)
|
||||||
|
const stack = err instanceof Error ? err.stack : undefined
|
||||||
|
const named = err instanceof NamedError ? err.toObject() : undefined
|
||||||
log.error("failed", {
|
log.error("failed", {
|
||||||
error: err,
|
error: err,
|
||||||
|
message: msg,
|
||||||
|
stack,
|
||||||
|
named,
|
||||||
})
|
})
|
||||||
if (err instanceof NamedError) {
|
if (err instanceof NamedError) {
|
||||||
let status: ContentfulStatusCode
|
let status: ContentfulStatusCode
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue