Exception: RequestError
- Inherits:
-
StandardError
- Object
- StandardError
- RequestError
- Defined in:
- lib/sideko_hacker_news.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(status_code, method, url, message) ⇒ RequestError
constructor
A new instance of RequestError.
Constructor Details
#initialize(status_code, method, url, message) ⇒ RequestError
Returns a new instance of RequestError.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sideko_hacker_news.rb', line 9 def initialize(status_code, method, url, ) @status_code = status_code @method = method @url = url begin @data = JSON.parse() rescue @data = end super("received #{status_code} from #{method} #{url} with #{}") end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/sideko_hacker_news.rb', line 7 def data @data end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/sideko_hacker_news.rb', line 7 def method @method end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
7 8 9 |
# File 'lib/sideko_hacker_news.rb', line 7 def status_code @status_code end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/sideko_hacker_news.rb', line 7 def url @url end |