Exception: Hacker::News::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Hacker::News::Error
- Defined in:
- lib/hacker/news/errors.rb
Overview
Base error class. Every exception the client raises is a subclass of this.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#status ⇒ Integer?
readonly
The HTTP status code, when applicable.
-
#url ⇒ String?
readonly
The URL being fetched when the error occurred.
Instance Method Summary collapse
-
#initialize(message, url: nil, status: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message, url: nil, status: nil) ⇒ Error
Returns a new instance of Error.
17 18 19 20 21 |
# File 'lib/hacker/news/errors.rb', line 17 def initialize(, url: nil, status: nil) super() @url = url @status = status end |
Instance Attribute Details
#status ⇒ Integer? (readonly)
Returns the HTTP status code, when applicable.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hacker/news/errors.rb', line 11 class Error < StandardError attr_reader :url, :status # @param message [String] # @param url [String, nil] # @param status [Integer, nil] def initialize(, url: nil, status: nil) super() @url = url @status = status end end |
#url ⇒ String? (readonly)
Returns the URL being fetched when the error occurred.
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/hacker/news/errors.rb', line 11 class Error < StandardError attr_reader :url, :status # @param message [String] # @param url [String, nil] # @param status [Integer, nil] def initialize(, url: nil, status: nil) super() @url = url @status = status end end |