Exception: Google::Cloud::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/google/cloud/errors.rb

Overview

Base google-cloud exception class.

Instance Method Summary collapse

Constructor Details

#initialize(msg = nil) ⇒ Error

Construct a new Google::Cloud::Error object, optionally passing in a message.



26
27
28
# File 'lib/google/cloud/errors.rb', line 26

def initialize msg = nil
  super
end

Instance Method Details

#bodyObject?

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.

Returns:

  • (Object, nil)


51
52
53
54
# File 'lib/google/cloud/errors.rb', line 51

def body
  return nil unless cause.respond_to? :body
  cause.body
end

#codeObject?

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.

Returns:

  • (Object, nil)


77
78
79
80
# File 'lib/google/cloud/errors.rb', line 77

def code
  return nil unless cause.respond_to? :code
  cause.code
end

#detailsObject?

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.

Returns:

  • (Object, nil)


90
91
92
93
# File 'lib/google/cloud/errors.rb', line 90

def details
  return nil unless cause.respond_to? :details
  cause.details
end

#headerObject?

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.

Returns:

  • (Object, nil)


64
65
66
67
# File 'lib/google/cloud/errors.rb', line 64

def header
  return nil unless cause.respond_to? :header
  cause.header
end

#metadataObject?

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.

Returns:

  • (Object, nil)


103
104
105
106
# File 'lib/google/cloud/errors.rb', line 103

def 
  return nil unless cause.respond_to? :metadata
  cause.
end

#status_codeObject?

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.

Returns:

  • (Object, nil)


38
39
40
41
# File 'lib/google/cloud/errors.rb', line 38

def status_code
  return nil unless cause.respond_to? :status_code
  cause.status_code
end

#status_detailsObject?

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.

Returns:

  • (Object, nil)


116
117
118
119
# File 'lib/google/cloud/errors.rb', line 116

def status_details
  return nil unless cause.respond_to? :status_details
  cause.status_details
end