diff --git a/src/hono-base.ts b/src/hono-base.ts index df782b97a..3e040da53 100644 --- a/src/hono-base.ts +++ b/src/hono-base.ts @@ -182,7 +182,8 @@ class Hono { let handler - if (app.#errorHandler === errorHandler) { + if (app.errorHandler === errorHandler) { handler = r.handler } else { handler = async (c: Context, next: Next) => - (await compose([], app.#errorHandler)(c, () => r.handler(c, next))).res + (await compose([], app.errorHandler)(c, () => r.handler(c, next))).res ;(handler as any)[COMPOSED_HANDLER] = r.handler } @@ -263,7 +264,7 @@ class Hono): Hono => { - this.#errorHandler = handler + this.errorHandler = handler return this } @@ -382,7 +383,7 @@ class Hono) { if (err instanceof Error) { - return this.#errorHandler(err, c) + return this.errorHandler(err, c) } throw err } @@ -431,7 +432,7 @@ class Hono(matchResult[0], this.#errorHandler, this.#notFoundHandler) + const composed = compose(matchResult[0], this.errorHandler, this.#notFoundHandler) return (async () => { try {