From bd1d1c1c0824382d7233d65ddcb34f1615f96cee Mon Sep 17 00:00:00 2001 From: Andrei Borza Date: Tue, 3 Sep 2024 13:47:23 +0900 Subject: [PATCH] fix(nestjs): Ensure exception and host are correctly passed on when using @WithSentry --- .github/workflows/build.yml | 1 + packages/nestjs/src/decorators/with-sentry.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 539f2537fc78..4f06228f3a7e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -908,6 +908,7 @@ jobs: 'nestjs-basic', 'nestjs-distributed-tracing', 'nestjs-with-submodules', + 'nestjs-with-submodules-decorator', 'nestjs-graphql', 'node-exports-test-app', 'node-koa', diff --git a/packages/nestjs/src/decorators/with-sentry.ts b/packages/nestjs/src/decorators/with-sentry.ts index 6b02d73a94c8..cf86ea6e7cc5 100644 --- a/packages/nestjs/src/decorators/with-sentry.ts +++ b/packages/nestjs/src/decorators/with-sentry.ts @@ -12,11 +12,11 @@ export function WithSentry() { // eslint-disable-next-line @typescript-eslint/no-explicit-any descriptor.value = function (exception: unknown, host: unknown, ...args: any[]) { if (isExpectedError(exception)) { - return originalCatch.apply(this, args); + return originalCatch.apply(this, [exception, host, ...args]); } captureException(exception); - return originalCatch.apply(this, args); + return originalCatch.apply(this, [exception, host, ...args]); }; return descriptor;