Exception: GRPC::BadStatus

Inherits:
StandardError
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(code, details = 'unknown cause', **kw) ⇒ BadStatus


43
44
45
46
47
48
# File 'src/ruby/lib/grpc/errors.rb', line 43

def initialize(code, details = 'unknown cause', **kw)
  super("#{code}:#{details}")
  @code = code
  @details = details
  @metadata = kw
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code


39
40
41
# File 'src/ruby/lib/grpc/errors.rb', line 39

def code
  @code
end

#detailsObject (readonly)

Returns the value of attribute details


39
40
41
# File 'src/ruby/lib/grpc/errors.rb', line 39

def details
  @details
end

#metadataObject (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_statusStatus

Converts the exception to a GRPC::Status for use in the networking wrapper layer.


54
55
56
# File 'src/ruby/lib/grpc/errors.rb', line 54

def to_status
  Struct::Status.new(code, details, @metadata)
end