Skip to content

Commit

Permalink
Merge e994864 into ed8b1ba
Browse files Browse the repository at this point in the history
  • Loading branch information
9renpoto committed Aug 5, 2020
2 parents ed8b1ba + e994864 commit f5cef06
Show file tree
Hide file tree
Showing 3 changed files with 158 additions and 387 deletions.
13 changes: 8 additions & 5 deletions lib/raven.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ import {
HttpArgumentsHost,
} from '@nestjs/common/interfaces';
import { Handlers } from '@sentry/node';
import {
GqlArgumentsHost,
GraphQLArgumentsHost,
GqlContextType,
} from '@nestjs/graphql';
import type { GraphQLArgumentsHost, GqlContextType } from '@nestjs/graphql';

let GqlArgumentsHost: any;
try {
({ GqlArgumentsHost } = require('@nestjs/graphql'));
} catch (e) {}

@Injectable()
export class RavenInterceptor implements NestInterceptor {
Expand Down Expand Up @@ -51,6 +52,8 @@ export class RavenInterceptor implements NestInterceptor {
exception,
);
case 'graphql':
if (!GqlArgumentsHost)
return this.captureException(scope, exception);
return this.captureGraphQLException(
scope,
GqlArgumentsHost.create(context),
Expand Down
Loading

0 comments on commit f5cef06

Please sign in to comment.