UNPKG

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