Exception: Gcloud::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Gcloud::Error
- Defined in:
- lib/gcloud/errors.rb
Overview
Base Gcloud exception class.
Direct Known Subclasses
AbortedError, AlreadyExistsError, Bigquery::Error, CanceledError, DataLossError, Datastore::Error, DeadlineExceededError, Dns::Error, FailedPreconditionError, InternalError, InvalidArgumentError, NotFoundError, OutOfRangeError, PermissionDeniedError, ResourceExhaustedError, ResourceManager::Error, Search::Error, Storage::Error, UnauthenticatedError, UnavailableError, UnimplementedError, UnknownError
Instance Attribute Summary collapse
-
#inner ⇒ Object
readonly
The inner error object.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message = nil, error = nil) ⇒ Error
constructor
Create a new error object.
Constructor Details
#initialize(message = nil, error = nil) ⇒ Error
Create a new error object.
26 27 28 29 |
# File 'lib/gcloud/errors.rb', line 26 def initialize = nil, error = nil super @inner = error end |
Instance Attribute Details
#inner ⇒ Object (readonly)
The inner error object.
22 23 24 |
# File 'lib/gcloud/errors.rb', line 22 def inner @inner end |
Class Method Details
.from_error(error) ⇒ Object
32 33 34 |
# File 'lib/gcloud/errors.rb', line 32 def self.from_error error klass_for(error).new error., error end |
.klass_for(error) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gcloud/errors.rb', line 37 def self.klass_for error return self.class unless error.is_a? GRPC::BadStatus # The gRPC status code 0 is for a successful response. # So there is no error subclass for a 0 status code, use current class. [self.class, CanceledError, UnknownError, InvalidArgumentError, DeadlineExceededError, NotFoundError, AlreadyExistsError, PermissionDeniedError, ResourceExhaustedError, FailedPreconditionError, AbortedError, OutOfRangeError, UnimplementedError, InternalError, UnavailableError, DataLossError, UnauthenticatedError ][error.code] || self.class end |