Skip to content

Commit

Permalink
🎉 feat: remove bind from app.handleError
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltyAom committed Sep 19, 2023
1 parent fefb05d commit 758f26a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/compose.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ export const composeHandler = ({

endError()

fnLiteral += `return handleError(c, error)\n\n`
fnLiteral += `return app.handleError(c, error)\n\n`

if (!maybeAsync) fnLiteral += '})()'

Expand Down Expand Up @@ -1290,7 +1290,7 @@ export const composeGeneralHandler = (app: Elysia<any, any, any, any, any>) => {
if (route === null)
return ${
app.event.error.length
? `handleError(ctx, notFound)`
? `app.handleError(ctx, notFound)`
: `new Response(error404, {
status: 404
})`
Expand Down Expand Up @@ -1324,7 +1324,6 @@ export const composeGeneralHandler = (app: Elysia<any, any, any, any, any>) => {
${staticRouter.variables}
const find = router.find.bind(router)
const handleError = app.handleError.bind(this)
${app.event.error.length ? '' : `const error404 = notFound.message.toString()`}
Expand Down Expand Up @@ -1400,7 +1399,7 @@ export const composeGeneralHandler = (app: Elysia<any, any, any, any, any>) => {
}

fnLiteral += `} catch (error) {
return handleError(ctx, error)
return app.handleError(ctx, error)
}`

endReport()
Expand Down

0 comments on commit 758f26a

Please # to comment.