Exception: Genius::Errors::PageNotFound
- Inherits:
-
GeniusExceptionSuperClass
- Object
- StandardError
- GeniusExceptionSuperClass
- Genius::Errors::PageNotFound
- Defined in:
- lib/genius/api/errors.rb
Overview
A PageNotFound object handles an exception where response payload is invalid and Genius itself or its related service returns not found.
Instance Attribute Summary collapse
-
#exception_type ⇒ Object
readonly
Returns the value of attribute exception_type.
-
#msg ⇒ Object
readonly
Returns the value of attribute msg.
Class Method Summary collapse
-
.page_not_found?(html) ⇒ Boolean
Checks if the HTML response indicates a page-not-found error.
Instance Method Summary collapse
-
#initialize(msg: 'Page not found. Try again with another response', exception_type: 'page_not_found') ⇒ void
constructor
Initializes a page-not-found error.
Constructor Details
#initialize(msg: 'Page not found. Try again with another response', exception_type: 'page_not_found') ⇒ void
Initializes a page-not-found error.
107 108 109 110 111 |
# File 'lib/genius/api/errors.rb', line 107 def initialize(msg: 'Page not found. Try again with another response', exception_type: 'page_not_found') @msg = msg @exception_type = exception_type super(msg) end |
Instance Attribute Details
#exception_type ⇒ Object (readonly)
Returns the value of attribute exception_type.
100 101 102 |
# File 'lib/genius/api/errors.rb', line 100 def exception_type @exception_type end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
100 101 102 |
# File 'lib/genius/api/errors.rb', line 100 def msg @msg end |
Class Method Details
.page_not_found?(html) ⇒ Boolean
Checks if the HTML response indicates a page-not-found error.
117 118 119 |
# File 'lib/genius/api/errors.rb', line 117 def self.page_not_found?(html) html.text.include?('Page not found') end |