Exception: SEPA::UnsupportedVersionError

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

Overview

Raised when ‘Message.new(country:, version:)` is called with a version the requested country doesn’t support. Carries the list of available versions so callers can recover or surface a helpful message.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(country:, version:, available_versions:, fallback_used: false) ⇒ UnsupportedVersionError

Returns a new instance of UnsupportedVersionError.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/sepa_rator/error.rb', line 27

def initialize(country:, version:, available_versions:, fallback_used: false)
  @country = country
  @version = version
  @available_versions = available_versions.dup.freeze
  @fallback_used = fallback_used

  scope =
    if fallback_used
      "country=#{country.inspect} (no dedicated profile — falling back to generic SEPA versions)"
    else
      "country=#{country.inspect}"
    end
  super("Version #{version.inspect} not supported for #{scope}. Available: #{@available_versions.inspect}")
end

Instance Attribute Details

#available_versionsObject (readonly)

Returns the value of attribute available_versions.



25
26
27
# File 'lib/sepa_rator/error.rb', line 25

def available_versions
  @available_versions
end

#countryObject (readonly)

Returns the value of attribute country.



25
26
27
# File 'lib/sepa_rator/error.rb', line 25

def country
  @country
end

#fallback_usedObject (readonly)

Returns the value of attribute fallback_used.



25
26
27
# File 'lib/sepa_rator/error.rb', line 25

def fallback_used
  @fallback_used
end

#versionObject (readonly)

Returns the value of attribute version.



25
26
27
# File 'lib/sepa_rator/error.rb', line 25

def version
  @version
end