From 37a732f7e731494d1676f81c14f4b9c13d1e661c Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Wed, 11 Oct 2023 07:47:33 +0000 Subject: [PATCH] fix: Added debug logging for api not found error --- .../global-exception/global-exception.filter.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts index e68b475037..f1576cfa9d 100644 --- a/packages/nocodb/src/filters/global-exception/global-exception.filter.ts +++ b/packages/nocodb/src/filters/global-exception/global-exception.filter.ts @@ -1,4 +1,4 @@ -import { Catch, Logger } from '@nestjs/common'; +import { Catch, Logger, NotFoundException } from '@nestjs/common'; import type { ArgumentsHost, ExceptionFilter } from '@nestjs/common'; import type { Response } from 'express'; import { @@ -31,11 +31,19 @@ export class GlobalExceptionFilter implements ExceptionFilter { exception instanceof Forbidden || exception instanceof NotFound || exception instanceof NotImplemented || - exception instanceof UnprocessableEntity + exception instanceof UnprocessableEntity || + exception instanceof NotFoundException ) ) this.logger.error(exception.message, exception.stack); + // API not found + if (exception instanceof NotFoundException) { + this.logger.debug(exception.message, exception.stack); + + return response.status(404).json({ msg: exception.message }); + } + const dbError = extractDBError(exception); if (dbError) {