diff options
author | John Millikin <jmillikin@stripe.com> | 2017-08-15 14:35:38 -0700 |
---|---|---|
committer | John Millikin <jmillikin@stripe.com> | 2017-08-16 11:25:18 -0700 |
commit | e3878523034dfa64e7c5525ea7afe1127f73c19b (patch) | |
tree | c11b387d3a32a19a5bf6c98fadd192f1c009ad28 /src/ruby/lib | |
parent | e60c0f82b55310efae040534541f5a6acec28aba (diff) |
Catch NotImplementedError exceptions and forward them to the client.
The old code only caught `StandardError`, which doesn't include
`NotImplementedError`. Despite the name, this error indicates a failure
of low-level OS interaction rather than unimplemented user code.
Any errors not caught by this section will cause the server to
terminate, which is generally undesirable because it might be happily
handling other requests.
Diffstat (limited to 'src/ruby/lib')
-rw-r--r-- | src/ruby/lib/grpc/generic/rpc_desc.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ruby/lib/grpc/generic/rpc_desc.rb b/src/ruby/lib/grpc/generic/rpc_desc.rb index 89cf8ff6a0..6fb6c412fb 100644 --- a/src/ruby/lib/grpc/generic/rpc_desc.rb +++ b/src/ruby/lib/grpc/generic/rpc_desc.rb @@ -99,9 +99,13 @@ module GRPC # event. Send a status of deadline exceeded GRPC.logger.warn("late call: #{active_call}") send_status(active_call, DEADLINE_EXCEEDED, 'late') - rescue StandardError => e + rescue StandardError, NotImplementedError => e # This will usuaally be an unhandled error in the handling code. # Send back a UNKNOWN status to the client + # + # Note: this intentionally does not map NotImplementedError to + # UNIMPLEMENTED because NotImplementedError is intended for low-level + # OS interaction (e.g. syscalls) not supported by the current OS. GRPC.logger.warn("failed handler: #{active_call}; sending status:UNKNOWN") GRPC.logger.warn(e) send_status(active_call, UNKNOWN, "#{e.class}: #{e.message}") |