matcher/old/modules/utils/pipes/rpc.validation-pipe.ts

15 lines
392 B
TypeScript
Raw Normal View History

2023-04-06 09:12:49 +00:00
import { Injectable, ValidationPipe } from '@nestjs/common';
import { RpcException } from '@nestjs/microservices';
@Injectable()
export class RpcValidationPipe extends ValidationPipe {
createExceptionFactory() {
return (validationErrors = []) => {
return new RpcException({
code: 3,
message: this.flattenValidationErrors(validationErrors),
});
};
}
}