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) ⇒ TrueClass, FalseClass
Genius::Errors::PageNotFound.page_not_found?
-> true or false.
Instance Method Summary collapse
Constructor Details
#initialize(msg: "Page not found. Try again with another response", exception_type: "page_not_found") ⇒ String (frozen)
100 101 102 103 104 |
# File 'lib/genius/api/errors.rb', line 100 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.
95 96 97 |
# File 'lib/genius/api/errors.rb', line 95 def exception_type @exception_type end |
#msg ⇒ Object (readonly)
Returns the value of attribute msg.
95 96 97 |
# File 'lib/genius/api/errors.rb', line 95 def msg @msg end |
Class Method Details
.page_not_found?(html) ⇒ TrueClass, FalseClass
Genius::Errors::PageNotFound.page_not_found?
-> true or false
PageNotFound.page_not_found?
method is used to be a predicate for handling 404 error.
114 115 116 |
# File 'lib/genius/api/errors.rb', line 114 def self.page_not_found?(html) html.text.match?(/Page not found/) end |