-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Injection with/in Exception filters? #302
Comments
Hi @VinceOPS, const httpExceptionFilter = app.get<HttpExceptionFilter>(HttpExceptionFilter);
app.useGlobalFilters(httpExceptionFilter); What do you think about that? |
Hi @kamilmysliwiec, thanks for the quick answer. Thanks for your work btw, I didn't go far with Nest yet, but I enjoy using it :). |
Sorry for pinging again, @kamilmysliwiec, but editing my comment was not a smart move as I assume you read issues/replies through your mailbox, like most of us. I was asking an other question, related to your suggestion:
Thanks again ;-). PS: I sent a few PR's on docs.nestjs.com 👍 |
Hi @VinceOPS, |
Hi @kamilmysliwiec! Thus, please tell me if I'm mistaken but, as I understand it: I would need to:
Will this process be enough to make the DI work in HttpExceptionFilter? In order to write Thanks again! Love the way the framework makes the nodejs/backend development so smooth :-). Plus the integration of Swagger is very nice! |
Hi @VinceOPS,
Yes, that will be enough. In fact, when you're using |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I'm submitting a...
Hi! I keep (slowly) going through the documentation of Nest and there is something kind of frustrating (to me) with Exception Filters: they have to be manually instantiated. I understand that they do not belong to a scope (as they're not in a module), but it raises two questions:
new HttpExceptionFilter(new LogsService())
touseGlobalFilters
.Current behavior
Expected behavior
Maybe something like:
or (but binding would be made automatically, I assume)
?
What is the motivation / use case for changing the behavior?
Benefit from DI with Exception Filters too.
Environment
The text was updated successfully, but these errors were encountered: