Class: Akamai::Core::Client::Error

Inherits:
Object
  • Object
show all
Defined in:
lib/akamai/core/client/error.rb

Defined Under Namespace

Classes: AkamaiError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body) ⇒ Error

Returns a new instance of Error.



10
11
12
# File 'lib/akamai/core/client/error.rb', line 10

def initialize(body)
  @body = /Array/ =~ body.class.name ? body[0] : body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



9
10
11
# File 'lib/akamai/core/client/error.rb', line 9

def body
  @body
end

Instance Method Details

#exist?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/akamai/core/client/error.rb', line 14

def exist?
  !!message
end

#raise_errorObject

Raises:

  • (error)


18
19
20
21
22
23
# File 'lib/akamai/core/client/error.rb', line 18

def raise_error
  error = AkamaiError.new.tap do |akamai_error|
    akamai_error.body = body
  end
  raise(error, message) if exist?
end