mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-22 03:05:19 -04:00
fix: correctly initialize exception mapping
The constructor of an exception filter must be given an instance of HttpAdapterHost, otherwise it will crash at runtime. This can be reproduced by GETing /. Reference: https://docs.nestjs.com/exception-filters#inheritance Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
bb115dedb6
commit
2c081b8dbf
2 changed files with 5 additions and 2 deletions
|
@ -6,6 +6,7 @@
|
|||
import {
|
||||
ArgumentsHost,
|
||||
BadRequestException,
|
||||
Catch,
|
||||
ConflictException,
|
||||
InternalServerErrorException,
|
||||
NotFoundException,
|
||||
|
@ -67,6 +68,7 @@ const mapOfHedgeDocErrorsToHttpErrors: Map<string, HttpExceptionConstructor> =
|
|||
],
|
||||
]);
|
||||
|
||||
@Catch()
|
||||
export class ErrorExceptionMapping extends BaseExceptionFilter<Error> {
|
||||
catch(error: Error, host: ArgumentsHost): void {
|
||||
super.catch(ErrorExceptionMapping.transformError(error), host);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue