Exception: Google::Cloud::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Google::Cloud::Error
- Defined in:
- lib/google/cloud/errors.rb
Overview
Base google-cloud exception class.
Direct Known Subclasses
AbortedError, AlreadyExistsError, CanceledError, DataLossError, DeadlineExceededError, FailedPreconditionError, InternalError, InvalidArgumentError, NotFoundError, OutOfRangeError, PermissionDeniedError, ResourceExhaustedError, UnauthenticatedError, UnavailableError, UnimplementedError, UnknownError
Instance Method Summary collapse
-
#body ⇒ Object
Returns the value of
bodyfrom the underlying cause error object, if both are present. -
#cause ⇒ Object
The previous exception at the time this exception was raised.
-
#code ⇒ Object
Returns the value of
codefrom the underlying cause error object, if both are present. -
#details ⇒ Object
Returns the value of
detailsfrom the underlying cause error object, if both are present. -
#header ⇒ Object
Returns the value of
headerfrom the underlying cause error object, if both are present. -
#initialize(msg = nil) ⇒ Error
constructor
Construct a new Google::Cloud::Error object, optionally passing in a message.
-
#metadata ⇒ Object
Returns the value of
metadatafrom the underlying cause error object, if both are present. -
#status_code ⇒ Object
Returns the value of
status_codefrom the underlying cause error object, if both are present. -
#status_details ⇒ Object
Returns the value of
status_detailsfrom the underlying cause error object, if both are present.
Constructor Details
#initialize(msg = nil) ⇒ Error
Construct a new Google::Cloud::Error object, optionally passing in a message.
26 27 28 29 |
# File 'lib/google/cloud/errors.rb', line 26 def initialize msg = nil super @cause = $ERROR_INFO end |
Instance Method Details
#body ⇒ Object
Returns the value of body from the underlying cause error
object, if both are present. Otherwise returns nil.
This is typically present on errors originating from calls to an API over HTTP/REST.
63 64 65 66 |
# File 'lib/google/cloud/errors.rb', line 63 def body return nil unless cause && cause.respond_to?(:body) cause.body end |
#cause ⇒ Object
The previous exception at the time this exception was raised. This is useful for wrapping exceptions and retaining the original exception information.
37 38 39 |
# File 'lib/google/cloud/errors.rb', line 37 define_method(:cause) do @cause end |
#code ⇒ Object
Returns the value of code from the underlying cause error
object, if both are present. Otherwise returns nil.
This is typically present on errors originating from calls to an API over gRPC.
89 90 91 92 |
# File 'lib/google/cloud/errors.rb', line 89 def code return nil unless cause && cause.respond_to?(:code) cause.code end |
#details ⇒ Object
Returns the value of details from the underlying cause error
object, if both are present. Otherwise returns nil.
This is typically present on errors originating from calls to an API over gRPC.
102 103 104 105 |
# File 'lib/google/cloud/errors.rb', line 102 def details return nil unless cause && cause.respond_to?(:details) cause.details end |
#header ⇒ Object
Returns the value of header from the underlying cause error
object, if both are present. Otherwise returns nil.
This is typically present on errors originating from calls to an API over HTTP/REST.
76 77 78 79 |
# File 'lib/google/cloud/errors.rb', line 76 def header return nil unless cause && cause.respond_to?(:header) cause.header end |
#metadata ⇒ Object
Returns the value of metadata from the underlying cause error
object, if both are present. Otherwise returns nil.
This is typically present on errors originating from calls to an API over gRPC.
115 116 117 118 |
# File 'lib/google/cloud/errors.rb', line 115 def return nil unless cause && cause.respond_to?(:metadata) cause. end |
#status_code ⇒ Object
Returns the value of status_code from the underlying cause error
object, if both are present. Otherwise returns nil.
This is typically present on errors originating from calls to an API over HTTP/REST.
50 51 52 53 |
# File 'lib/google/cloud/errors.rb', line 50 def status_code return nil unless cause && cause.respond_to?(:status_code) cause.status_code end |
#status_details ⇒ Object
Returns the value of status_details from the underlying cause error
object, if both are present. Otherwise returns nil.
This is typically present on errors originating from calls to an API over gRPC.
128 129 130 131 |
# File 'lib/google/cloud/errors.rb', line 128 def status_details return nil unless cause && cause.respond_to?(:status_details) cause.status_details end |