From 31e6635a2a9ceb905944915c299ca238bf186f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Og=C3=B3rek?= Date: Tue, 4 Aug 2026 10:49:59 +0200 Subject: [PATCH] fix(hono): Include originalException in captured exception hint --- packages/hono/src/shared/middlewareHandlers.ts | 1 + packages/hono/test/shared/middlewareHandlers.test.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/packages/hono/src/shared/middlewareHandlers.ts b/packages/hono/src/shared/middlewareHandlers.ts index 665c1afd3631..9edf0c1df234 100644 --- a/packages/hono/src/shared/middlewareHandlers.ts +++ b/packages/hono/src/shared/middlewareHandlers.ts @@ -94,6 +94,7 @@ export function responseHandler( if ((shouldHandleError ?? defaultShouldHandleError)(context.error)) { getClient()?.captureException(context.error, { mechanism: { handled: false, type: 'auto.http.hono.context_error' }, + originalException: context.error, }); } } diff --git a/packages/hono/test/shared/middlewareHandlers.test.ts b/packages/hono/test/shared/middlewareHandlers.test.ts index f4ccfe9cd1d3..1b496af5fc3d 100644 --- a/packages/hono/test/shared/middlewareHandlers.test.ts +++ b/packages/hono/test/shared/middlewareHandlers.test.ts @@ -75,6 +75,7 @@ describe('responseHandler', () => { expect(mockCaptureException).toHaveBeenCalledWith(error, { mechanism: { handled: false, type: 'auto.http.hono.context_error' }, + originalException: error, }); }); @@ -90,6 +91,7 @@ describe('responseHandler', () => { expect(mockCaptureException).toHaveBeenCalledWith(error, { mechanism: { handled: false, type: 'auto.http.hono.context_error' }, + originalException: error, }); }); @@ -126,6 +128,7 @@ describe('responseHandler', () => { expect(mockCaptureException).toHaveBeenCalledWith(error, { mechanism: { handled: false, type: 'auto.http.hono.context_error' }, + originalException: error, }); }); @@ -167,6 +170,7 @@ describe('responseHandler', () => { expect(mockCaptureException).toHaveBeenCalledWith(error, { mechanism: { handled: false, type: 'auto.http.hono.context_error' }, + originalException: error, }); }); }); @@ -185,6 +189,7 @@ describe('responseHandler', () => { expect(shouldHandleError).toHaveBeenCalledWith(error); expect(mockCaptureException).toHaveBeenCalledWith(error, { mechanism: { handled: false, type: 'auto.http.hono.context_error' }, + originalException: error, }); }); @@ -212,6 +217,7 @@ describe('responseHandler', () => { expect(mockCaptureException).toHaveBeenCalledWith(error, { mechanism: { handled: false, type: 'auto.http.hono.context_error' }, + originalException: error, }); });