Exception: Unit::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/unit-ruby/util/error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_response) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
# File 'lib/unit-ruby/util/error.rb', line 5

def initialize(api_response)
  error = api_response['errors'].first
  @message = error['title']
  @status = error['status']
  @details = error['details'] || error['detail']

  super(@details)
end

Instance Attribute Details

#detailObject

Returns the value of attribute detail.



3
4
5
# File 'lib/unit-ruby/util/error.rb', line 3

def detail
  @detail
end

#detailsObject

Returns the value of attribute details.



3
4
5
# File 'lib/unit-ruby/util/error.rb', line 3

def details
  @details
end

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/unit-ruby/util/error.rb', line 3

def message
  @message
end

#statusObject

Returns the value of attribute status.



3
4
5
# File 'lib/unit-ruby/util/error.rb', line 3

def status
  @status
end