Skip to content

Commit

Permalink
fix: remove null parameter signatures for tap (#198)
Browse files Browse the repository at this point in the history
Co-authored-by: Tine Jozelj <tine@tjo.space>
  • Loading branch information
9renpoto and mentos1386 committed Mar 2, 2021
1 parent 74b7fda commit 57132be
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 46 deletions.
92 changes: 47 additions & 45 deletions lib/raven.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,56 +41,58 @@ export class RavenInterceptor implements NestInterceptor {

// first param would be for events, second is for errors
return next.handle().pipe(
tap(null, (exception) => {
if (this.shouldReport(exception)) {
Sentry.withScope((scope) => {
switch (context.getType<GqlContextType>()) {
case 'http':
this.addHttpExceptionMetadatas(scope, context.switchToHttp());
return this.captureException(
scope,
exception,
localTransformers,
);
case 'ws':
this.addWsExceptionMetadatas(scope, context.switchToWs());
return this.captureException(
scope,
exception,
localTransformers,
);
case 'rpc':
this.addRpcExceptionMetadatas(scope, context.switchToRpc());
return this.captureException(
scope,
exception,
localTransformers,
);
case 'graphql':
if (!GqlArgumentsHost)
tap({
error: (exception) => {
if (this.shouldReport(exception)) {
Sentry.withScope((scope) => {
switch (context.getType<GqlContextType>()) {
case 'http':
this.addHttpExceptionMetadatas(scope, context.switchToHttp());
return this.captureException(
scope,
exception,
localTransformers,
);
this.addGraphQLExceptionMetadatas(
scope,
GqlArgumentsHost.create(context),
);
return this.captureException(
scope,
exception,
localTransformers,
);
default:
return this.captureException(
scope,
exception,
localTransformers,
);
}
});
}
case 'ws':
this.addWsExceptionMetadatas(scope, context.switchToWs());
return this.captureException(
scope,
exception,
localTransformers,
);
case 'rpc':
this.addRpcExceptionMetadatas(scope, context.switchToRpc());
return this.captureException(
scope,
exception,
localTransformers,
);
case 'graphql':
if (!GqlArgumentsHost)
return this.captureException(
scope,
exception,
localTransformers,
);
this.addGraphQLExceptionMetadatas(
scope,
GqlArgumentsHost.create(context),
);
return this.captureException(
scope,
exception,
localTransformers,
);
default:
return this.captureException(
scope,
exception,
localTransformers,
);
}
});
}
},
}),
);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
},
"husky": {
"hooks": {
"*.ts" : [
"*.ts": [
"prettier --write"
],
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
Expand Down

0 comments on commit 57132be

Please sign in to comment.