1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.Catch = void 0;
|
4 | const 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 | */
|
22 | function Catch(...exceptions) {
|
23 | return (target) => {
|
24 | Reflect.defineMetadata(constants_1.CATCH_WATERMARK, true, target);
|
25 | Reflect.defineMetadata(constants_1.FILTER_CATCH_EXCEPTIONS, exceptions, target);
|
26 | };
|
27 | }
|
28 | exports.Catch = Catch;
|