grpc-js: don't overwrite existing error codes

This commit causes RPC handlers to default to INTERNAL when
an error occurs, but does not overwrite an existing error
code.
This commit is contained in:
cjihrig 2019-06-21 19:34:45 -04:00
parent 00b091a1b1
commit 7c2bb2a237
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -374,7 +374,11 @@ export class Server {
}
} catch (err) {
const call = new Http2ServerCallStream(stream, null!);
err.code = Status.INTERNAL;
if (err.code === undefined) {
err.code = Status.INTERNAL;
}
call.sendError(err);
}
}