diff --git a/backend/src/common/filters/global-exception.filter.ts b/backend/src/common/filters/global-exception.filter.ts index 49994634..0d8c1201 100644 --- a/backend/src/common/filters/global-exception.filter.ts +++ b/backend/src/common/filters/global-exception.filter.ts @@ -24,6 +24,12 @@ export class GlobalExceptionFilter implements ExceptionFilter { private readonly logger = new Logger(GlobalExceptionFilter.name); catch(exception: any, host: ArgumentsHost) { + // Guard: only handle HTTP contexts (not WebSocket, RPC, etc.) + if (!host || host.getType() !== 'http') { + this.logger.error(`Non-HTTP exception caught: ${exception?.message ?? exception}`); + return; + } + const ctx = host.switchToHttp(); const response = ctx.getResponse(); const request = ctx.getRequest();