Browse Source

refactor: sentry capturing

pull/6772/head
Pranav C 11 months ago
parent
commit
9faaf38f37
  1. 10
      packages/nocodb/src/filters/global-exception/global-exception.filter.ts

10
packages/nocodb/src/filters/global-exception/global-exception.filter.ts

@ -18,10 +18,10 @@ import {
@Catch()
export class GlobalExceptionFilter implements ExceptionFilter {
constructor(
@Optional() @InjectSentry() private readonly sentryClient: SentryService,
@Optional() @InjectSentry() protected readonly sentryClient: SentryService,
) {}
private logger = new Logger(GlobalExceptionFilter.name);
protected logger = new Logger(GlobalExceptionFilter.name);
catch(exception: any, host: ArgumentsHost) {
const ctx = host.switchToHttp();
@ -106,7 +106,7 @@ export class GlobalExceptionFilter implements ExceptionFilter {
if (exception.getStatus?.()) {
response.status(exception.getStatus()).json(exception.getResponse());
} else {
this.sentryClient?.instance().captureException(exception);
this.captureException(exception, request);
// todo: change the response code
response.status(400).json({
@ -114,4 +114,8 @@ export class GlobalExceptionFilter implements ExceptionFilter {
});
}
}
protected captureException(exception: any, _request: any) {
this.sentryClient?.instance().captureException(exception);
}
}

Loading…
Cancel
Save