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:
David Mehren 2022-02-11 19:20:54 +01:00
parent bb115dedb6
commit 2c081b8dbf
2 changed files with 5 additions and 2 deletions

View file

@ -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);