Skip to content

Commit

Permalink
enhancement(@nestjs/microservices) disable internal gRPC errors swallow
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilmysliwiec committed Jul 4, 2018
1 parent 3d2d838 commit 3cf8607
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
6 changes: 4 additions & 2 deletions packages/microservices/client/client-grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ export class ClientGrpcProxy extends ClientProxy implements ClientGrpc {

const context = grpcPackage.load(options);
return context;
} catch (e) {
} catch (err) {
const invalidProtoError = new InvalidProtoDefinitionException();
this.logger.error(invalidProtoError.message, invalidProtoError.stack);
const message = err && err.message ? err.message : invalidProtoError.message;

this.logger.error(message, invalidProtoError.stack);
throw invalidProtoError;
}
}
Expand Down
6 changes: 4 additions & 2 deletions packages/microservices/server/server-grpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,11 @@ export class ServerGrpc extends Server implements CustomTransportStrategy {

const context = grpcPackage.load(options);
return context;
} catch (e) {
} catch (err) {
const invalidProtoError = new InvalidProtoDefinitionException();
this.logger.error(invalidProtoError.message, invalidProtoError.stack);
const message = err && err.message ? err.message : invalidProtoError.message;

this.logger.error(message, invalidProtoError.stack);
throw invalidProtoError;
}
}
Expand Down
2 changes: 1 addition & 1 deletion sample/04-grpc/src/grpc-client.options.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Transport, ClientOptions } from '@nestjs/microservices';
import { ClientOptions, Transport } from '@nestjs/microservices';
import { join } from 'path';

export const grpcClientOptions: ClientOptions = {
Expand Down

0 comments on commit 3cf8607

Please sign in to comment.