Exception: Peddler::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Peddler::Error
- Defined in:
- lib/peddler/error.rb,
lib/peddler/error/builder.rb,
sig/peddler/error.rbs,
sig/peddler/error/builder.rbs
Direct Known Subclasses
Peddler::Errors::AccessDenied, Peddler::Errors::InternalFailure, Peddler::Errors::InvalidGrant, Peddler::Errors::InvalidInput, Peddler::Errors::InvalidRequest, Peddler::Errors::NotFound, Peddler::Errors::QuotaExceeded, Peddler::Errors::Unauthorized, Peddler::Errors::UnsupportedGrantType
Instance Attribute Summary collapse
-
#response ⇒ HTTP::Response?
readonly
Instance Method Summary collapse
-
#deconstruct_keys(keys) ⇒ Hash
Supports pattern matching on status.
-
#initialize(msg = nil, response = nil) ⇒ Error
constructor
A new instance of Error.
-
#status ⇒ Integer?
Constructor Details
#initialize(msg = nil, response = nil) ⇒ Error
Returns a new instance of Error.
19 20 21 22 |
# File 'lib/peddler/error.rb', line 19 def initialize(msg = nil, response = nil) @response = response super(msg) end |
Instance Attribute Details
#response ⇒ HTTP::Response? (readonly)
6 7 8 |
# File 'lib/peddler/error.rb', line 6 def response @response end |
Instance Method Details
#deconstruct_keys(keys) ⇒ Hash
Supports pattern matching on status
39 40 41 42 |
# File 'lib/peddler/error.rb', line 39 def deconstruct_keys(keys) hash = { status: status } keys ? hash.slice(*keys) : hash end |
#status ⇒ Integer?
25 26 27 |
# File 'lib/peddler/error.rb', line 25 def status response&.status&.code end |