UNPKG

913 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.Catch = void 0;
4const constants_1 = require("../../constants");
5/**
6 * Decorator that marks a class as a Nest exception filter. An exception filter
7 * handles exceptions thrown by or not handled by your application code.
8 *
9 * The decorated class must implement the `ExceptionFilter` interface.
10 *
11 * @param exceptions one or more exception *types* specifying
12 * the exceptions to be caught and handled by this filter.
13 *
14 * @see [Exception Filters](https://docs.nestjs.com/exception-filters)
15 *
16 * @usageNotes
17 * Exception filters are applied using the `@UseFilters()` decorator, or (globally)
18 * with `app.useGlobalFilters()`.
19 *
20 * @publicApi
21 */
22function Catch(...exceptions) {
23 return (target) => {
24 Reflect.defineMetadata(constants_1.FILTER_CATCH_EXCEPTIONS, exceptions, target);
25 };
26}
27exports.Catch = Catch;