Skip to content

Commit

Permalink
fix: capture stacktrace from createError
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Jan 20, 2021
1 parent b376b4e commit 1441784
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export function createError (input: Partial<H3Error>): H3Error {
if (input instanceof H3Error) {
return input
}

const err = new H3Error(input.message)
Error.captureStackTrace(err, createError)

if (input.statusCode) {
err.statusCode = input.statusCode
}
Expand Down

0 comments on commit 1441784

Please sign in to comment.