Exception: RDStation::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rdstation/error.rb,
lib/rdstation/error/format.rb,
lib/rdstation/error/formatter.rb

Defined Under Namespace

Classes: ConflictingField, Default, ExpiredAccessToken, ExpiredCodeGrant, Format, Formatter, InvalidCredentials, InvalidEventType, ResourceNotFound, Unauthorized

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(details) ⇒ Error

Returns a new instance of Error.

Raises:

  • (ArgumentError)


6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/rdstation/error.rb', line 6

def initialize(details)
  @details = details
  message = details['error_message']
  raise ArgumentError, 'The details hash must contain an error message' unless message

  # Those three arguments are kept only for compatibility reasons.
  # They aren't needed since we can get them directly in the details hash.
  # Consider removing them when update the major version.
  @http_status = details['http_status']
  @headers = details['headers']
  @body = details['body']

  super(message)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



4
5
6
# File 'lib/rdstation/error.rb', line 4

def body
  @body
end

#detailsObject (readonly)

Returns the value of attribute details.



4
5
6
# File 'lib/rdstation/error.rb', line 4

def details
  @details
end

#headersObject (readonly)

Returns the value of attribute headers.



4
5
6
# File 'lib/rdstation/error.rb', line 4

def headers
  @headers
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



4
5
6
# File 'lib/rdstation/error.rb', line 4

def http_status
  @http_status
end