Improve RestApiExceptionFilter (#12967)
RestApiExceptionFilter is used as an exception filter for the core controller which is used for crud operations on our objects (equivalent of our dynamic queries findManyPeople etc. on the graphql API). Exceptions were leading a 400 / BadRequestException response status which can be confusing to users. By default we should actually throw a 500 if the error was not handled priorily, but we have not implemented input validation for the REST api so we fear to be flooded with errors that should not be 500 but 400 due to user inputs. A solution should be brought [with this ticket](https://github.com/twentyhq/core-team-issues/issues/1027) but it has not been prioritized yet.
This commit is contained in:
@ -86,7 +86,9 @@ export const shouldCaptureException = (
|
||||
return true;
|
||||
};
|
||||
|
||||
export const handleException = <T extends Error | CustomException>({
|
||||
export const handleException = <
|
||||
T extends Error | CustomException | HttpException,
|
||||
>({
|
||||
exception,
|
||||
exceptionHandlerService,
|
||||
user,
|
||||
|
||||
Reference in New Issue
Block a user