UNPKG

1.2 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.ExceptionFiltersContext = void 0;
4const constants_1 = require("@nestjs/common/constants");
5const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
6const base_exception_filter_context_1 = require("@nestjs/core/exceptions/base-exception-filter-context");
7const ws_exceptions_handler_1 = require("../exceptions/ws-exceptions-handler");
8/**
9 * @publicApi
10 */
11class ExceptionFiltersContext extends base_exception_filter_context_1.BaseExceptionFilterContext {
12 constructor(container) {
13 super(container);
14 }
15 create(instance, callback, moduleKey) {
16 this.moduleContext = moduleKey;
17 const exceptionHandler = new ws_exceptions_handler_1.WsExceptionsHandler();
18 const filters = this.createContext(instance, callback, constants_1.EXCEPTION_FILTERS_METADATA);
19 if ((0, shared_utils_1.isEmpty)(filters)) {
20 return exceptionHandler;
21 }
22 exceptionHandler.setCustomFilters(filters.reverse());
23 return exceptionHandler;
24 }
25 getGlobalMetadata() {
26 return [];
27 }
28}
29exports.ExceptionFiltersContext = ExceptionFiltersContext;