Skip to content

Commit 13a26ae

Browse files
Merge pull request #3019 from jeengbe/patch-2
fix: remove redundant paragraph
2 parents 9187a83 + a688ba7 commit 13a26ae

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

content/exception-filters.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Here's an example overriding the entire response body and providing an error cau
7070
async findAll() {
7171
try {
7272
await this.service.findAll()
73-
} catch (error) {
73+
} catch (error) {
7474
throw new HttpException({
7575
status: HttpStatus.FORBIDDEN,
7676
error: 'This is a custom message',
@@ -260,7 +260,7 @@ async create(createCatDto) {
260260

261261
> info **Hint** Prefer applying filters by using classes instead of instances when possible. It reduces **memory usage** since Nest can easily reuse instances of the same class across your entire module.
262262
263-
In the example above, the `HttpExceptionFilter` is applied only to the single `create()` route handler, making it method-scoped. Exception filters can be scoped at different levels: method-scoped of the controller/resolver/gateway, controller-scoped, or global-scoped.
263+
In the example above, the `HttpExceptionFilter` is applied only to the single `create()` route handler, making it method-scoped. Exception filters can be scoped at different levels: method-scoped of the controller/resolver/gateway, controller-scoped, or global-scoped.
264264
For example, to set up a filter as controller-scoped, you would do the following:
265265

266266
```typescript
@@ -383,8 +383,6 @@ export class AllExceptionsFilter extends BaseExceptionFilter {
383383

384384
> warning **Warning** Method-scoped and Controller-scoped filters that extend the `BaseExceptionFilter` should not be instantiated with `new`. Instead, let the framework instantiate them automatically.
385385
386-
The above implementation is just a shell demonstrating the approach. Your implementation of the extended exception filter would include your tailored **business** logic (e.g., handling various conditions).
387-
388386
Global filters **can** extend the base filter. This can be done in either of two ways.
389387

390388
The first method is to inject the `HttpAdapter` reference when instantiating the custom global filter:

0 commit comments

Comments
 (0)