-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #646 from energywebfoundation/task/SWTCH-2403_text…
…_based_content_injection SWTCH-2403 Text based content injection
- Loading branch information
Showing
5 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
docs/api/classes/common_not_found_exception_filter.NotFoundExceptionFilter.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Class: NotFoundExceptionFilter | ||
|
||
[common/not-found-exception-filter](../modules/common_not_found_exception_filter.md).NotFoundExceptionFilter | ||
|
||
## Implements | ||
|
||
- `ExceptionFilter` | ||
|
||
## Table of contents | ||
|
||
### Constructors | ||
|
||
- [constructor](common_not_found_exception_filter.NotFoundExceptionFilter.md#constructor) | ||
|
||
### Methods | ||
|
||
- [catch](common_not_found_exception_filter.NotFoundExceptionFilter.md#catch) | ||
|
||
## Constructors | ||
|
||
### constructor | ||
|
||
• **new NotFoundExceptionFilter**() | ||
|
||
## Methods | ||
|
||
### catch | ||
|
||
▸ **catch**(`exception`, `host`): `void` | ||
|
||
#### Parameters | ||
|
||
| Name | Type | | ||
| :------ | :------ | | ||
| `exception` | `any` | | ||
| `host` | `ArgumentsHost` | | ||
|
||
#### Returns | ||
|
||
`void` | ||
|
||
#### Implementation of | ||
|
||
ExceptionFilter.catch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Module: common/not-found-exception-filter | ||
|
||
## Table of contents | ||
|
||
### Classes | ||
|
||
- [NotFoundExceptionFilter](../classes/common_not_found_exception_filter.NotFoundExceptionFilter.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { | ||
ArgumentsHost, | ||
Catch, | ||
ExceptionFilter, | ||
NotFoundException, | ||
} from '@nestjs/common'; | ||
import { Response } from 'express'; | ||
|
||
@Catch(NotFoundException) | ||
export class NotFoundExceptionFilter implements ExceptionFilter { | ||
catch(exception: any, host: ArgumentsHost) { | ||
const ctx = host.switchToHttp(); | ||
const response = ctx.getResponse<Response>(); | ||
const status = exception.getStatus(); | ||
|
||
response.status(status).send('<html>Page not found</html>'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters