Skip to content
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

Feature Request: add support for using PrismaClientExceptionFilter as a controller/gateway/method level filter #87

Open
recursive-beast opened this issue Nov 24, 2023 · 0 comments

Comments

@recursive-beast
Copy link

Using PrismaClientExceptionFilter as a filter for a nestjs gateway in this manner for example:

import { UseFilters } from '@nestjs/common';
import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets';
import { PrismaClientExceptionFilter } from 'nestjs-prisma';

@UseFilters(PrismaClientExceptionFilter)
@WebSocketGateway()
export class AppGateway {
  @SubscribeMessage('message')
  handleMessage(client: any, payload: any): string {
    return 'Hello world!';
  }
}

errors with this in the console:

[Nest] 8884  - 24/11/2023, 22:17:06   ERROR [ExceptionHandler] Nest can't resolve dependencies of the PrismaClientExceptionFilter (?, Object). Please make sure that the argument Object at index [0] is available in the ChatModule context.

Potential solutions:
- Is ChatModule a valid NestJS module?
- If Object is a provider, is it part of the current ChatModule?
- If Object is exported from a separate @Module, is that module imported within ChatModule?
  @Module({
    imports: [ /* the Module containing Object */ ]
  })

nestjs can't inject the first argument of the constructor. I tried the same for a controller and It gives me the same error. Are there any plans to support this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant