From 758f26ac4aecac57803473b50c171c9b4f240bc7 Mon Sep 17 00:00:00 2001 From: saltyaom Date: Wed, 20 Sep 2023 00:51:53 +0700 Subject: [PATCH] :tada: feat: remove bind from app.handleError --- src/compose.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compose.ts b/src/compose.ts index b3d5f679..175e6d50 100644 --- a/src/compose.ts +++ b/src/compose.ts @@ -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 += '})()' @@ -1290,7 +1290,7 @@ export const composeGeneralHandler = (app: Elysia) => { if (route === null) return ${ app.event.error.length - ? `handleError(ctx, notFound)` + ? `app.handleError(ctx, notFound)` : `new Response(error404, { status: 404 })` @@ -1324,7 +1324,6 @@ export const composeGeneralHandler = (app: Elysia) => { ${staticRouter.variables} const find = router.find.bind(router) - const handleError = app.handleError.bind(this) ${app.event.error.length ? '' : `const error404 = notFound.message.toString()`} @@ -1400,7 +1399,7 @@ export const composeGeneralHandler = (app: Elysia) => { } fnLiteral += `} catch (error) { - return handleError(ctx, error) + return app.handleError(ctx, error) }` endReport()