Exception: Siwe::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Siwe::Error
- Defined in:
- lib/siwe/error.rb
Instance Attribute Summary collapse
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
-
#received ⇒ Object
readonly
Returns the value of attribute received.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, expected: nil, received: nil, message: nil) ⇒ Error
constructor
A new instance of Error.
- #to_h ⇒ Object
Constructor Details
#initialize(type, expected: nil, received: nil, message: nil) ⇒ Error
Returns a new instance of Error.
9 10 11 12 13 14 15 16 |
# File 'lib/siwe/error.rb', line 9 def initialize(type, expected: nil, received: nil, message: nil) raise ArgumentError, "unknown SIWE error type: #{type.inspect}" unless ErrorType::MESSAGES.key?(type) @type = type @expected = expected @received = received super( || ErrorType::MESSAGES.fetch(type)) end |
Instance Attribute Details
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
7 8 9 |
# File 'lib/siwe/error.rb', line 7 def expected @expected end |
#received ⇒ Object (readonly)
Returns the value of attribute received.
7 8 9 |
# File 'lib/siwe/error.rb', line 7 def received @received end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/siwe/error.rb', line 7 def type @type end |
Instance Method Details
#to_h ⇒ Object
18 19 20 |
# File 'lib/siwe/error.rb', line 18 def to_h { type: @type, expected: @expected, received: @received, message: } end |