Exception: SwedishPIN::ParseError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/swedish_pin/errors.rb

Overview

Error that represents a problem that occurred while parsing a Personnummer.

You can inspect both the #input attribute and check the subclass to build more helpful error messages for your users.

Direct Known Subclasses

InvalidChecksum, InvalidDate, InvalidFormat

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, input) ⇒ ParseError

Create a new instance of this error.

Parameters:

  • message (String)

    The error message.

  • input (String)

    The input string that could not be parsed.



20
21
22
23
# File 'lib/swedish_pin/errors.rb', line 20

def initialize(message, input)
  super(message)
  @input = input
end

Instance Attribute Details

#inputObject (readonly)

The input string that caused the error.

Examples:

error.input # => "112233@4455"


14
15
16
# File 'lib/swedish_pin/errors.rb', line 14

def input
  @input
end