diff --git a/content/microservices/pipes.md b/content/microservices/pipes.md index ac83ecc2a1..5e2968070b 100644 --- a/content/microservices/pipes.md +++ b/content/microservices/pipes.md @@ -10,13 +10,13 @@ The following example uses a manually instantiated method-scoped pipe. Just as w ```typescript @@filename() -@UsePipes(new ValidationPipe()) +@UsePipes(new ValidationPipe({ exceptionFactory: (errors) => new RpcException(errors) })) @MessagePattern({ cmd: 'sum' }) accumulate(data: number[]): number { return (data || []).reduce((a, b) => a + b); } @@switch -@UsePipes(new ValidationPipe()) +@UsePipes(new ValidationPipe({ exceptionFactory: (errors) => new RpcException(errors) })) @MessagePattern({ cmd: 'sum' }) accumulate(data) { return (data || []).reduce((a, b) => a + b); diff --git a/content/websockets/pipes.md b/content/websockets/pipes.md index d0706887de..9e465e41dc 100644 --- a/content/websockets/pipes.md +++ b/content/websockets/pipes.md @@ -10,14 +10,14 @@ The following example uses a manually instantiated method-scoped pipe. Just as w ```typescript @@filename() -@UsePipes(new ValidationPipe()) +@UsePipes(new ValidationPipe({ exceptionFactory: (errors) => new WsException(errors) })) @SubscribeMessage('events') handleEvent(client: Client, data: unknown): WsResponse { const event = 'events'; return { event, data }; } @@switch -@UsePipes(new ValidationPipe()) +@UsePipes(new ValidationPipe({ exceptionFactory: (errors) => new WsException(errors) })) @SubscribeMessage('events') handleEvent(client, data) { const event = 'events';