diff options
author | Alexander Polcyn <apolcyn@google.com> | 2016-11-30 08:35:52 -0800 |
---|---|---|
committer | Alexander Polcyn <apolcyn@google.com> | 2016-11-30 10:01:39 -0800 |
commit | 174aa915bae4b379932e4887e26f2953db52b954 (patch) | |
tree | 2ca63f0c207da3f2f3832533b020a33d75a6f21c /src/ruby/pb | |
parent | acacd0d6467109e452e7375f662240c26fca004f (diff) |
change client code to use specific exceptions and throw bad status if
unkown code
Diffstat (limited to 'src/ruby/pb')
-rw-r--r-- | src/ruby/pb/grpc/health/checker.rb | 4 | ||||
-rwxr-xr-x | src/ruby/pb/test/client.rb | 7 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/ruby/pb/grpc/health/checker.rb b/src/ruby/pb/grpc/health/checker.rb index 4bce1744c4..6b2d852ebf 100644 --- a/src/ruby/pb/grpc/health/checker.rb +++ b/src/ruby/pb/grpc/health/checker.rb @@ -52,7 +52,9 @@ module Grpc @status_mutex.synchronize do status = @statuses["#{req.service}"] end - fail GRPC::BadStatus, StatusCodes::NOT_FOUND if status.nil? + if status.nil? + fail GRPC::BadStatus.new_status_exception(StatusCodes::NOT_FOUND) + end HealthCheckResponse.new(status: status) end diff --git a/src/ruby/pb/test/client.rb b/src/ruby/pb/test/client.rb index b9af160e7a..9ee5cdf9fd 100755 --- a/src/ruby/pb/test/client.rb +++ b/src/ruby/pb/test/client.rb @@ -338,11 +338,8 @@ class NamedTests deadline = GRPC::Core::TimeConsts::from_relative_time(1) resps = @stub.full_duplex_call(enum.each_item, deadline: deadline) resps.each { } # wait to receive each request (or timeout) - fail 'Should have raised GRPC::BadStatus(DEADLINE_EXCEEDED)' - rescue GRPC::BadStatus => e - assert("#{__callee__}: status was wrong") do - e.code == GRPC::Core::StatusCodes::DEADLINE_EXCEEDED - end + fail 'Should have raised GRPC::DeadlineExceeded' + rescue GRPC::DeadlineExceeded end def empty_stream |