class Google::Cloud::Spanner::Status
# Status
Represents a logical error model from the Spanner
service, containing an error code, an error message, and optional error details.
@attr [Integer] code The status code, which should be an enum value of
[google.rpc.Code](https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto).
@attr [String] description The human-readable description for the status
code, which should be an enum value of [google.rpc.Code](https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto). For example, `INVALID_ARGUMENT`.
@attr [String] message A developer-facing error message, which should be
in English.
@attr [Array, nil] details A list of messages that carry the error
details.
@example
require "google/cloud/spanner" spanner = Google::Cloud::Spanner.new job = spanner.create_database "my-instance", "my-new-database" job.wait_until_done! if job.error? status = job.error end
Attributes
code[R]
description[R]
details[R]
message[R]
Public Class Methods
description_for(code)
click to toggle source
@private Get a descriptive symbol for a google.rpc.Code integer
# File lib/google/cloud/spanner/status.rb, line 73 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)
click to toggle source
@private New Status
from a Google::Rpc::Status object.
# File lib/google/cloud/spanner/status.rb, line 68 def self.from_grpc grpc new grpc.code, description_for(grpc.code), grpc.message, grpc.details end
new(code, description, message, details)
click to toggle source
@private Creates a Status
object.
# File lib/google/cloud/spanner/status.rb, line 59 def initialize code, description, message, details @code = code @description = description @message = message @details = details end