Skip to content

Commit 9b8f9ea

Browse files
authored
fix(nestjs): Ensure exception and host are correctly passed on when using @WithSentry (#13564)
Also adds the `nestjs-with-submodules-decorator` e2e test app to be run on CI.
1 parent c9c346c commit 9b8f9ea

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.github/workflows/build.yml

+1
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ jobs:
908908
'nestjs-basic',
909909
'nestjs-distributed-tracing',
910910
'nestjs-with-submodules',
911+
'nestjs-with-submodules-decorator',
911912
'nestjs-graphql',
912913
'node-exports-test-app',
913914
'node-koa',

packages/nestjs/src/decorators/with-sentry.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export function WithSentry() {
1212
// eslint-disable-next-line @typescript-eslint/no-explicit-any
1313
descriptor.value = function (exception: unknown, host: unknown, ...args: any[]) {
1414
if (isExpectedError(exception)) {
15-
return originalCatch.apply(this, args);
15+
return originalCatch.apply(this, [exception, host, ...args]);
1616
}
1717

1818
captureException(exception);
19-
return originalCatch.apply(this, args);
19+
return originalCatch.apply(this, [exception, host, ...args]);
2020
};
2121

2222
return descriptor;

0 commit comments

Comments
 (0)