Exception: NatureRemo::Error
- Inherits:
-
StandardError
- Object
- StandardError
- NatureRemo::Error
- Defined in:
- lib/nature_remo/errors.rb
Overview
Error class for Nature Remo API
Direct Known Subclasses
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(env:) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(env:) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/nature_remo/errors.rb', line 9 def initialize(env:) @env = env @url = env.url @status = env.status @headers = env.response_headers @body = env.body msg = "request failed with status code #{@status}" msg += ", #{@body}" if @body super(msg) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
6 7 8 |
# File 'lib/nature_remo/errors.rb', line 6 def body @body end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
6 7 8 |
# File 'lib/nature_remo/errors.rb', line 6 def env @env end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
6 7 8 |
# File 'lib/nature_remo/errors.rb', line 6 def error_code @error_code end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
6 7 8 |
# File 'lib/nature_remo/errors.rb', line 6 def headers @headers end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'lib/nature_remo/errors.rb', line 6 def status @status end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
6 7 8 |
# File 'lib/nature_remo/errors.rb', line 6 def url @url end |