http-exception-filter-prisma-nestjs
v1.0.32
Published
An exception filter to handle Prisma errors in NestJS. / Um filtro de exceção para lidar com erros do Prisma no NestJS.
Downloads
24
Maintainers
Readme
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 {}