Exception: Iconoclasm::HTTPError
- Defined in:
- lib/iconoclasm/errors.rb
Instance Method Summary collapse
- #code ⇒ Object
- #http_error_message ⇒ Object
- #http_error_reason ⇒ Object
-
#initialize(url, response) ⇒ HTTPError
constructor
A new instance of HTTPError.
- #message ⇒ Object
Constructor Details
#initialize(url, response) ⇒ HTTPError
Returns a new instance of HTTPError.
16 17 18 19 |
# File 'lib/iconoclasm/errors.rb', line 16 def initialize(url, response) super(url) @response = response end |
Instance Method Details
#code ⇒ Object
28 29 30 |
# File 'lib/iconoclasm/errors.rb', line 28 def code @response.respond_to?(:response_code) ? @response.response_code : @response[/\d{3}/] end |
#http_error_message ⇒ Object
36 37 38 |
# File 'lib/iconoclasm/errors.rb', line 36 def "#{@code}: #{http_error_reason}" end |
#http_error_reason ⇒ Object
32 33 34 |
# File 'lib/iconoclasm/errors.rb', line 32 def http_error_reason @response.respond_to?(:header_str) ? error_reason : @response end |
#message ⇒ Object
21 22 23 24 25 26 |
# File 'lib/iconoclasm/errors.rb', line 21 def msg = "" msg += "There was a problem getting #{@url} " if @url msg += "(#{http_error_reason})" msg end |