Exception: Greeve::ResponseError
- Inherits:
-
StandardError
- Object
- StandardError
- Greeve::ResponseError
- Defined in:
- lib/greeve/response_error.rb
Overview
HTTP response failed.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
HTTP error code.
-
#status_message ⇒ Object
readonly
HTTP error message.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ ResponseError
constructor
A new instance of ResponseError.
-
#message ⇒ String
Exception error message.
Constructor Details
#initialize(opts = {}) ⇒ ResponseError
Returns a new instance of ResponseError.
11 12 13 14 |
# File 'lib/greeve/response_error.rb', line 11 def initialize(opts = {}) @code = opts.fetch(:code).to_i @status_message = opts.fetch(:status_message).dup.freeze end |
Instance Attribute Details
#code ⇒ Object (readonly)
HTTP error code
5 6 7 |
# File 'lib/greeve/response_error.rb', line 5 def code @code end |
#status_message ⇒ Object (readonly)
HTTP error message
7 8 9 |
# File 'lib/greeve/response_error.rb', line 7 def @status_message end |
Instance Method Details
#message ⇒ String
Returns exception error message.
17 18 19 |
# File 'lib/greeve/response_error.rb', line 17 def "#{@code} #{@status_message}" end |