UNPKG

@nestjs/websockets

Version:

Nest - modern, fast, powerful node.js web framework (@websockets)

25 lines (24 loc) 942 B
import { WsExceptionsHandler } from '../exceptions/ws-exceptions-handler.js'; import { EXCEPTION_FILTERS_METADATA, isEmptyArray, } from '@nestjs/common/internal'; import { BaseExceptionFilterContext, STATIC_CONTEXT, } from '@nestjs/core/internal'; /** * @publicApi */ export class ExceptionFiltersContext extends BaseExceptionFilterContext { constructor(container) { super(container); } create(instance, callback, moduleKey, contextId = STATIC_CONTEXT, inquirerId) { this.moduleContext = moduleKey; const exceptionHandler = new WsExceptionsHandler(); const filters = this.createContext(instance, callback, EXCEPTION_FILTERS_METADATA, contextId, inquirerId); if (isEmptyArray(filters)) { return exceptionHandler; } exceptionHandler.setCustomFilters(filters.reverse()); return exceptionHandler; } getGlobalMetadata() { return []; } }