mirror of https://github.com/grpc/grpc-node.git
Fix Node status code usage to match spec
This commit is contained in:
parent
4a7a8ba3a7
commit
a1c6f889b7
|
@ -339,7 +339,7 @@ function _read(size) {
|
|||
try {
|
||||
deserialized = self.deserialize(data);
|
||||
} catch (e) {
|
||||
e.code = grpc.status.INVALID_ARGUMENT;
|
||||
e.code = grpc.status.INTERNAL;
|
||||
self.emit('error', e);
|
||||
return;
|
||||
}
|
||||
|
@ -475,7 +475,7 @@ function handleUnary(call, handler, metadata) {
|
|||
try {
|
||||
emitter.request = handler.deserialize(result.read);
|
||||
} catch (e) {
|
||||
e.code = grpc.status.INVALID_ARGUMENT;
|
||||
e.code = grpc.status.INTERNAL;
|
||||
handleError(call, e);
|
||||
return;
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ function handleServerStreaming(call, handler, metadata) {
|
|||
try {
|
||||
stream.request = handler.deserialize(result.read);
|
||||
} catch (e) {
|
||||
e.code = grpc.status.INVALID_ARGUMENT;
|
||||
e.code = grpc.status.INTERNAL;
|
||||
stream.emit('error', e);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -709,14 +709,14 @@ describe('Other conditions', function() {
|
|||
it('should respond correctly to a unary call', function(done) {
|
||||
misbehavingClient.unary(badArg, function(err, data) {
|
||||
assert(err);
|
||||
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
|
||||
assert.strictEqual(err.code, grpc.status.INTERNAL);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('should respond correctly to a client stream', function(done) {
|
||||
var call = misbehavingClient.clientStream(function(err, data) {
|
||||
assert(err);
|
||||
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
|
||||
assert.strictEqual(err.code, grpc.status.INTERNAL);
|
||||
done();
|
||||
});
|
||||
call.write(badArg);
|
||||
|
@ -729,7 +729,7 @@ describe('Other conditions', function() {
|
|||
assert.fail(data, null, 'Unexpected data', '===');
|
||||
});
|
||||
call.on('error', function(err) {
|
||||
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
|
||||
assert.strictEqual(err.code, grpc.status.INTERNAL);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -739,7 +739,7 @@ describe('Other conditions', function() {
|
|||
assert.fail(data, null, 'Unexpected data', '===');
|
||||
});
|
||||
call.on('error', function(err) {
|
||||
assert.strictEqual(err.code, grpc.status.INVALID_ARGUMENT);
|
||||
assert.strictEqual(err.code, grpc.status.INTERNAL);
|
||||
done();
|
||||
});
|
||||
call.write(badArg);
|
||||
|
|
Loading…
Reference in New Issue