|
|
|
@ -48,7 +48,6 @@ describe GRPC::RpcDesc do |
|
|
|
|
@bidi_streamer = RpcDesc.new('ss', Stream.new(Object.new), |
|
|
|
|
Stream.new(Object.new), 'encode', 'decode') |
|
|
|
|
@bs_code = INTERNAL |
|
|
|
|
@no_reason = 'unkown error handling call on server' |
|
|
|
|
@ok_response = Object.new |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -62,8 +61,9 @@ describe GRPC::RpcDesc do |
|
|
|
|
|
|
|
|
|
it 'sends status UNKNOWN if other StandardErrors are raised' do |
|
|
|
|
expect(@call).to receive(:remote_read).once.and_return(Object.new) |
|
|
|
|
expect(@call).to receive(:send_status) .once.with(UNKNOWN, @no_reason, |
|
|
|
|
false, metadata: {}) |
|
|
|
|
expect(@call).to receive(:send_status).once.with(UNKNOWN, |
|
|
|
|
arg_error_msg, |
|
|
|
|
false, metadata: {}) |
|
|
|
|
this_desc.run_server_method(@call, method(:other_error)) |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -112,7 +112,7 @@ describe GRPC::RpcDesc do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'sends status UNKNOWN if other StandardErrors are raised' do |
|
|
|
|
expect(@call).to receive(:send_status).once.with(UNKNOWN, @no_reason, |
|
|
|
|
expect(@call).to receive(:send_status).once.with(UNKNOWN, arg_error_msg, |
|
|
|
|
false, metadata: {}) |
|
|
|
|
@client_streamer.run_server_method(@call, method(:other_error_alt)) |
|
|
|
|
end |
|
|
|
@ -174,8 +174,9 @@ describe GRPC::RpcDesc do |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it 'sends status UNKNOWN if other StandardErrors are raised' do |
|
|
|
|
error_msg = arg_error_msg(StandardError.new) |
|
|
|
|
expect(@call).to receive(:run_server_bidi).and_raise(StandardError) |
|
|
|
|
expect(@call).to receive(:send_status).once.with(UNKNOWN, @no_reason, |
|
|
|
|
expect(@call).to receive(:send_status).once.with(UNKNOWN, error_msg, |
|
|
|
|
false, metadata: {}) |
|
|
|
|
@bidi_streamer.run_server_method(@call, method(:other_error_alt)) |
|
|
|
|
end |
|
|
|
@ -342,4 +343,9 @@ describe GRPC::RpcDesc do |
|
|
|
|
def other_error_alt(_call) |
|
|
|
|
fail(ArgumentError, 'other error') |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def arg_error_msg(error = nil) |
|
|
|
|
error ||= ArgumentError.new('other error') |
|
|
|
|
"#{error.class}: #{error.message}" |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|