Module: GrpcKit::Errors

Included in:
GRPC
Defined in:
lib/grpc_kit/errors.rb

Defined Under Namespace

Classes: Aborted, AlreadyExists, BadStatus, Cancelled, DataLoss, DeadlineExceeded, DoNotUse, FailedPrecondition, Internal, InvalidArgument, NotFound, Ok, OutOfRange, PermissionDenied, ResourceExhausted, Unauthenticated, Unavailable, Unimplemented, Unknown

Constant Summary collapse

CODES =
{
  GrpcKit::StatusCodes::OK                  => Ok,
  GrpcKit::StatusCodes::CANCELLED           => Cancelled,
  GrpcKit::StatusCodes::UNKNOWN             => Unknown,
  GrpcKit::StatusCodes::INVALID_ARGUMENT    => InvalidArgument,
  GrpcKit::StatusCodes::DEADLINE_EXCEEDED   => DeadlineExceeded,
  GrpcKit::StatusCodes::NOT_FOUND           => NotFound,
  GrpcKit::StatusCodes::ALREADY_EXISTS      => AlreadyExists,
  GrpcKit::StatusCodes::PERMISSION_DENIED   => PermissionDenied,
  GrpcKit::StatusCodes::RESOURCE_EXHAUSTED  => ResourceExhausted,
  GrpcKit::StatusCodes::FAILED_PRECONDITION => FailedPrecondition,
  GrpcKit::StatusCodes::ABORTED             => Aborted,
  GrpcKit::StatusCodes::OUT_OF_RANGE        => OutOfRange,
  GrpcKit::StatusCodes::UNIMPLEMENTED       => Unimplemented,
  GrpcKit::StatusCodes::INTERNAL            => Internal,
  GrpcKit::StatusCodes::UNAVAILABLE         => Unavailable,
  GrpcKit::StatusCodes::DATA_LOSS           => DataLoss,
  GrpcKit::StatusCodes::UNAUTHENTICATED     => Unauthenticated,
  GrpcKit::StatusCodes::DO_NOT_USE          => DoNotUse,
}.freeze

Class Method Summary collapse

Class Method Details

.from_status_code(code, message) ⇒ GrpcKit::Errors::BadStatus


12
13
14
# File 'lib/grpc_kit/errors.rb', line 12

def self.from_status_code(code, message)
  CODES.fetch(code).new(message)
end