http-exception-filter-prisma-nestjs
TypeScript icon, indicating that this package has built-in type declarations

1.0.32 • Public • Published

Error handle for prisma.io with NestJs / Captura de erros do prisma.io com NestJS

Installing

Package manager

Using npm:

$ npm i http-exception-filter-prisma-nestjs

Main file

import { HttpExceptionFilter } from 'http-exception-filter-prisma-nestjs';

Add the code inside your Bootstrap function / Adicione o codigo dentro de sua função Bootstrap

app.useGlobalFilters(new HttpExceptionFilter());

example / exemplo

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.useGlobalFilters(new HttpExceptionFilter());
  app.enableShutdownHooks();
  await app.listen(3001);
}
bootstrap();

Module file (app.module.ts)

import { HttpExceptionFilter } from 'http-exception-filter-prisma-nestjs';

add the snippet below in providers / adicione o trecho abaixo em providers

PrismaService,
    {
      provide: APP_FILTER,
      useClass: HttpExceptionFilter,
    },

example of use / exemplo de uso

@Module({
  imports: [],
  controllers: [],
  providers: [
    PrismaService,
    {
      provide: APP_FILTER,
      useClass: HttpExceptionFilter,
    },
  ],
})
export class AppModule {}

Package Sidebar

Install

npm i http-exception-filter-prisma-nestjs

Weekly Downloads

4

Version

1.0.32

License

MIT

Unpacked Size

112 kB

Total Files

10

Last publish

Collaborators

  • leandro.gazoli