-
-
Notifications
You must be signed in to change notification settings - Fork 1
Description
hi! good lib!
as of now, due to the usage of response.type,response.send and so on, this exception filter only works for http adapters that implements such methods on their response object. Express and Fastify has them but 3rd-party http adapters might not have (because they aren't needed for nestjs core AFIAK)
nest-problem-details/libs/nest-problem-details-filter/src/filters/http-exception.filter.ts
Lines 55 to 66 in 43ad7c9
| response | |
| .type(PROBLEM_CONTENT_TYPE) | |
| .status(status) | |
| .send({ | |
| ...objectExtras, | |
| type: [this.baseUri, type || this.getDefaultType(status)] | |
| .filter(Boolean) | |
| .join('/'), | |
| title, | |
| status, | |
| detail, | |
| }); |
My suggestion is using the HttpAdapterHost instead like the docs shows here: https://docs.nestjs.com/exception-filters#catch-everything
at same time, as we need to inject that dependency into the HttpExceptionFilter, there's no way to add this feature without introducing a breaking change because now one will need to supply that new parameter when using the app.useGlobalFilters bind approach (like described here)
so yeah, it's up to you 😄
btw I'd like to contribute to this project because of Hacktoberfest :p