Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/content/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Alternatively, you can use a class instead of a factory:

```ts
import { Module } from '@nestjs/common';
import { ConfigModule } from '@nestjs/config';
import { PrismaModule } from 'nestjs-prisma';

@Module({
Expand Down
21 changes: 16 additions & 5 deletions docs/src/content/docs/exception-filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ Instantiate the filter in your `main.ts` and pass the `HttpAdapterHost`

```ts
//src/main.ts
import { ValidationPipe } from '@nestjs/common';
import { HttpAdapterHost, NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { PrismaClientExceptionFilter } from 'nestjs-prisma';
Expand Down Expand Up @@ -67,7 +66,6 @@ Or use `providePrismaClientExceptionFilter()` (available since `v0.21.0-dev.0`)
```ts
//src/app.module.ts
import { Module } from '@nestjs/common';
import { APP_FILTER, HttpAdapterHost } from '@nestjs/core';
import { providePrismaClientExceptionFilter } from 'nestjs-prisma';

@Module({
Expand All @@ -84,7 +82,7 @@ Provide your own error code mapping, if you like to catch additional [Prisma Cli

```ts
//src/main.ts
import { ValidationPipe } from '@nestjs/common';
import { HttpStatus } from '@nestjs/common';
import { HttpAdapterHost, NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { PrismaClientExceptionFilter } from 'nestjs-prisma';
Expand All @@ -111,7 +109,7 @@ bootstrap();

```ts
//src/app.module.ts
import { Module } from '@nestjs/common';
import { HttpStatus, Module } from '@nestjs/common';
import { APP_FILTER, HttpAdapterHost } from '@nestjs/core';
import { PrismaClientExceptionFilter } from 'nestjs-prisma';

Expand All @@ -129,7 +127,20 @@ import { PrismaClientExceptionFilter } from 'nestjs-prisma';
},
inject: [HttpAdapterHost],
},
// or
],
})
export class AppModule {}
```

Or use `providePrismaClientExceptionFilter()` (available since `v0.21.0-dev.0`)

```ts
//src/app.module.ts
import { HttpStatus, Module } from '@nestjs/common';
import { providePrismaClientExceptionFilter } from 'nestjs-prisma';

@Module({
providers: [
providePrismaClientExceptionFilter({
// Prisma Error Code: HTTP Status Response
P2000: HttpStatus.BAD_REQUEST,
Expand Down
1 change: 1 addition & 0 deletions docs/src/content/docs/logging-middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Change the log level from your `.env` file using the [@nestjs/config](https://do

```ts
import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { PrismaModule, loggingMiddleware, QueryInfo } from 'nestjs-prisma';

@Module({
Expand Down