We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e84dcf commit 9913bdaCopy full SHA for 9913bda
lib/grpc/GrpcServer.ts
@@ -19,9 +19,19 @@ class GrpcServer {
19
constructor(private logger: Logger) {
20
this.server = serverProxy(new grpc.Server());
21
22
- this.server.use((ctx: any, next: any) => {
+ this.server.use(async (ctx: any, next: any) => {
23
logger.debug(`received call ${ctx.service.path}`);
24
- next();
+
25
+ await next();
26
27
+ const status = ctx.status || ctx.call.status;
28
+ if (!status) {
29
+ logger.debug(`unknown status for call ${ctx.service.path}`);
30
+ } else if (status.code !== 0) {
31
+ logger.error(`call ${ctx.service.path} errored with code ${status.details.code}: ${status.details.message}`);
32
+ } else {
33
+ logger.trace(`call ${ctx.service.path} succeeded`);
34
+ }
35
});
36
}
37
0 commit comments