Class: Google::Cloud::Spanner::Status
- Inherits:
-
Object
- Object
- Google::Cloud::Spanner::Status
- Defined in:
- lib/google/cloud/spanner/status.rb
Overview
# Status
Represents a logical error model from the Spanner service, containing an error code, an error message, and optional error details.
Instance Attribute Summary collapse
-
#code ⇒ Integer
The status code, which should be an enum value of [google.rpc.Code](github.com/googleapis/googleapis/blob/master/google/rpc/code.proto).
-
#description ⇒ String
The human-readable description for the status code, which should be an enum value of [google.rpc.Code](github.com/googleapis/googleapis/blob/master/google/rpc/code.proto).
-
#details ⇒ Array?
A list of messages that carry the error details.
-
#message ⇒ String
A developer-facing error message, which should be in English.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, description, message, details) ⇒ Status
constructor
A new instance of Status.
Constructor Details
#initialize(code, description, message, details) ⇒ Status
Returns a new instance of Status.
55 56 57 58 59 60 |
# File 'lib/google/cloud/spanner/status.rb', line 55 def initialize code, description, , details @code = code @description = description @message = @details = details end |
Instance Attribute Details
#code ⇒ Integer
The status code, which should be an enum value of [google.rpc.Code](github.com/googleapis/googleapis/blob/master/google/rpc/code.proto).
50 51 52 |
# File 'lib/google/cloud/spanner/status.rb', line 50 def code @code end |
#description ⇒ String
The human-readable description for the status code, which should be an enum value of [google.rpc.Code](github.com/googleapis/googleapis/blob/master/google/rpc/code.proto). For example, ‘INVALID_ARGUMENT`.
50 51 52 |
# File 'lib/google/cloud/spanner/status.rb', line 50 def description @description end |
#details ⇒ Array?
A list of messages that carry the error details.
50 51 52 |
# File 'lib/google/cloud/spanner/status.rb', line 50 def details @details end |
#message ⇒ String
A developer-facing error message, which should be in English.
50 51 52 |
# File 'lib/google/cloud/spanner/status.rb', line 50 def @message end |
Class Method Details
.description_for(code) ⇒ Object
69 70 71 72 73 74 75 76 77 |
# File 'lib/google/cloud/spanner/status.rb', line 69 def self.description_for code descriptions = %w( OK CANCELLED UNKNOWN INVALID_ARGUMENT DEADLINE_EXCEEDED NOT_FOUND ALREADY_EXISTS PERMISSION_DENIED RESOURCE_EXHAUSTED FAILED_PRECONDITION ABORTED OUT_OF_RANGE UNIMPLEMENTED INTERNAL UNAVAILABLE DATA_LOSS UNAUTHENTICATED ) descriptions[code] end |
.from_grpc(grpc) ⇒ Object
64 65 66 |
# File 'lib/google/cloud/spanner/status.rb', line 64 def self.from_grpc grpc new grpc.code, description_for(grpc.code), grpc., grpc.details end |