Class: Postmen::RequestError

Inherits:
Error
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/postmen/errors.rb

Overview

Generic exception raised if the API returns an error

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ RequestError

Returns a new instance of RequestError.



11
12
13
# File 'lib/postmen/errors.rb', line 11

def initialize(request)
  @request = request
end

Instance Method Details

#codeObject

Internal API error code



29
30
31
# File 'lib/postmen/errors.rb', line 29

def code
  meta[:code]
end

#detailsObject

Returns details for the request error

See Also:



23
24
25
# File 'lib/postmen/errors.rb', line 23

def details
  meta[:details]
end

#messageObject

Returns human-readable error message

See Also:



35
36
37
# File 'lib/postmen/errors.rb', line 35

def message
  meta[:message]
end

#retryable?Boolean

Indicates whether request is retryable.

Returns:

  • (Boolean)

See Also:



17
18
19
# File 'lib/postmen/errors.rb', line 17

def retryable?
  meta.fetch(:retryable, false)
end