The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix unhandled exception (#5474)
martmull4fcdfbff7dfa
diff --git a/packages/twenty-server/src/utils/apply-cors-to-exceptions.ts b/packages/twenty-server/src/utils/apply-cors-to-exceptions.tsindex 1b17fd2ab1c..0dd3a5cc12e 100644--- a/packages/twenty-server/src/utils/apply-cors-to-exceptions.ts+++ b/packages/twenty-server/src/utils/apply-cors-to-exceptions.ts@@ -1,4 +1,9 @@-import { ExceptionFilter, Catch, ArgumentsHost } from '@nestjs/common';+import {+ ExceptionFilter,+ Catch,+ ArgumentsHost,+ HttpException,+} from '@nestjs/common';import { Response } from 'express';@@ -25,6 +30,9 @@ export class ApplyCorsToExceptions implements ExceptionFilter {'Origin, X-Requested-With, Content-Type, Accept',);- response.status(exception.getStatus()).json(exception.response);+ const status =+ exception instanceof HttpException ? exception.getStatus() : 500;++ response.status(status).json(exception.response);}}