diff options
author | 2015-04-17 12:39:25 -0700 | |
---|---|---|
committer | 2015-04-17 12:40:59 -0700 | |
commit | 1c5faea6734f00dd8327a8dbca939b797fd5bdfb (patch) | |
tree | e1ec04c2739f70c0c639d41e3ca75404800a6b3c /src | |
parent | 3fd2be2e32ab9edf2030f06c707e0c5cca140755 (diff) |
Allow BadStatus to contain metadata
Diffstat (limited to 'src')
-rw-r--r-- | src/ruby/lib/grpc/errors.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ruby/lib/grpc/errors.rb b/src/ruby/lib/grpc/errors.rb index 35e9c02a94..f1201c1704 100644 --- a/src/ruby/lib/grpc/errors.rb +++ b/src/ruby/lib/grpc/errors.rb @@ -36,14 +36,15 @@ module GRPC # error should be returned to the other end of a GRPC connection; when # caught it means that this end received a status error. class BadStatus < StandardError - attr_reader :code, :details + attr_reader :code, :details, :metadata # @param code [Numeric] the status code # @param details [String] the details of the exception - def initialize(code, details = 'unknown cause') + def initialize(code, details = 'unknown cause', **kw) super("#{code}:#{details}") @code = code @details = details + @metadata = kw end # Converts the exception to a GRPC::Status for use in the networking @@ -51,7 +52,7 @@ module GRPC # # @return [Status] with the same code and details def to_status - Status.new(code, details) + Struct::Status.new(code, details, @metadata) end end |