Sha256: 1b970f5097477d3d3251ee3b4c6f1b3fff36eb362a37c68d77f5edf65d19e863

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

require 'pathname'
require 'i18n'

module Citizenship
  class Error < StandardError
    def initialize(key, values = {}, scope)
      super(I18n.t(key, values.merge(scope: "citizenship.#{scope}")))
    end
  end

  class NIFError < Error
    def initialize(key, values = {})
      super(key, values, :nif)
    end
  end

  class NIBError < Error
    def initialize(key, values = {})
      super(key, values, :nib)
    end
  end

  class CitizenCardError < Error
    def initialize(key, values = {})
      super(key, values, :citizen_card)
    end
  end

  class IdentificationCardError < Error
    def initialize(key, values = {})
      super(key, values, :identification_card)
    end
  end

  class PhoneError < Error
    def initialize(key, values = {})
      super(key, values, :phone)
    end
  end

  class EmailError < Error
    def initialize(key, values = {})
      super(key, values, :email)
    end
  end

  class ZipCodeError < Error
    def initialize(key, values = {})
      super(key, values, :zip_code)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citizenship-1.0.0 lib/citizenship/errors.rb