Exception: GRPC::BadStatus
- Inherits:
-
StandardError
- Object
- StandardError
- GRPC::BadStatus
- Defined in:
- src/ruby/lib/grpc/errors.rb
Overview
BadStatus is an exception class that indicates that an error occurred at either end of a GRPC connection. When raised, it indicates that a status error should be returned to the other end of a GRPC connection; when caught it means that this end received a status error.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Instance Method Summary collapse
-
#initialize(code, details = 'unknown cause', metadata = {}) ⇒ BadStatus
constructor
A new instance of BadStatus.
-
#to_status ⇒ Status
Converts the exception to a GRPC::Status for use in the networking wrapper layer.
Constructor Details
#initialize(code, details = 'unknown cause', metadata = {}) ⇒ BadStatus
Returns a new instance of BadStatus.
44 45 46 47 48 49 |
# File 'src/ruby/lib/grpc/errors.rb', line 44 def initialize(code, details = 'unknown cause', = {}) super("#{code}:#{details}") @code = code @details = details @metadata = end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
39 40 41 |
# File 'src/ruby/lib/grpc/errors.rb', line 39 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
39 40 41 |
# File 'src/ruby/lib/grpc/errors.rb', line 39 def details @details end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
39 40 41 |
# File 'src/ruby/lib/grpc/errors.rb', line 39 def @metadata end |
Instance Method Details
#to_status ⇒ Status
Converts the exception to a GRPC::Status for use in the networking wrapper layer.
55 56 57 |
# File 'src/ruby/lib/grpc/errors.rb', line 55 def to_status Struct::Status.new(code, details, @metadata) end |