Skip to content

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

@recursive-beast

Description

@recursive-beast

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions