Browse Source

Merge pull request #5625 from nocodb/nest--add-error-logger-to-global-exception-filter

add error logging in nest global exception filter
pull/5634/head
Daniel Spaude 2 years ago committed by GitHub
parent
commit
2ab0917d5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      packages/nocodb/src/filters/global-exception/global-exception.filter.ts

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

@ -1,4 +1,4 @@
import { Catch, HttpException } from '@nestjs/common';
import { Catch, Logger } from '@nestjs/common';
import {
AjvError,
BadRequest,
@ -14,11 +14,12 @@ import type { Response } from 'express';
@Catch()
export class GlobalExceptionFilter implements ExceptionFilter {
private logger = new Logger(GlobalExceptionFilter.name);
catch(exception: any, host: ArgumentsHost) {
const ctx = host.switchToHttp();
const response = ctx.getResponse<Response>();
// todo: error log
this.logger.error(exception.message, exception.stack);
const dbError = extractDBError(exception);

Loading…
Cancel
Save