Exception: Tina4Ultipa::GrpcClient::RpcError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/tina4_ultipa/grpc.rb

Overview

Raised by Channel#unary when the peer returns a non-OK grpc-status trailer.

Constant Summary collapse

GRPC_STATUS_NAMES =
{
  0 => "OK", 1 => "CANCELLED", 2 => "UNKNOWN", 3 => "INVALID_ARGUMENT",
  4 => "DEADLINE_EXCEEDED", 5 => "NOT_FOUND", 6 => "ALREADY_EXISTS",
  7 => "PERMISSION_DENIED", 8 => "RESOURCE_EXHAUSTED", 9 => "FAILED_PRECONDITION",
  10 => "ABORTED", 11 => "OUT_OF_RANGE", 12 => "UNIMPLEMENTED",
  13 => "INTERNAL", 14 => "UNAVAILABLE", 15 => "DATA_LOSS",
  16 => "UNAUTHENTICATED",
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status_code, message) ⇒ RpcError

Returns a new instance of RpcError.



37
38
39
40
41
# File 'lib/tina4_ultipa/grpc.rb', line 37

def initialize(status_code, message)
  @status_code = status_code
  @status_name = GRPC_STATUS_NAMES[status_code] || "STATUS_#{status_code}"
  super("gRPC #{@status_name}: #{message}")
end

Instance Attribute Details

#status_codeObject (readonly)

Returns the value of attribute status_code.



26
27
28
# File 'lib/tina4_ultipa/grpc.rb', line 26

def status_code
  @status_code
end

#status_nameObject (readonly)

Returns the value of attribute status_name.



26
27
28
# File 'lib/tina4_ultipa/grpc.rb', line 26

def status_name
  @status_name
end