Exception: SEPA::UnknownCountryError

Inherits:
Error
  • Object
show all
Defined in:
lib/sepa_rator/error.rb

Overview

Raised when ‘Message.new(country:)` is called with a symbol that isn’t a recognized SEPA country code. Catches typos like ‘:fre` instead of `:fr`, which would otherwise silently fall back to the generic EPC profile.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(country:, known_countries:) ⇒ UnknownCountryError

Returns a new instance of UnknownCountryError.



13
14
15
16
17
18
# File 'lib/sepa_rator/error.rb', line 13

def initialize(country:, known_countries:)
  @country = country
  @known_countries = known_countries
  super("Unknown country #{country.inspect}. Known SEPA countries: " \
        "#{known_countries.sort.inspect}. Pass `country: nil` to use the generic SEPA profile.")
end

Instance Attribute Details

#countryObject (readonly)

Returns the value of attribute country.



11
12
13
# File 'lib/sepa_rator/error.rb', line 11

def country
  @country
end

#known_countriesObject (readonly)

Returns the value of attribute known_countries.



11
12
13
# File 'lib/sepa_rator/error.rb', line 11

def known_countries
  @known_countries
end