ukraine-taxid-ex/lib/ukraine_taxid_ex/itin/error.ex

25 lines
701 B
Elixir
Raw Permalink Normal View History

defmodule UkraineTaxidEx.Itin.Error do
@type error() ::
:invalid_length
| :invalid_checksum
2024-12-13 05:34:25 +00:00
| :length_too_long
| :length_too_short
@type errors() :: [error()]
@errors [
:invalid_length,
:invalid_checksum,
2024-12-13 05:34:25 +00:00
:length_too_long,
:length_too_short
]
@messages [
2024-12-13 02:17:30 +00:00
invalid_length: "ITIN violates the required length",
invalid_checksum: "ITIN checksum is invalid",
2024-12-13 05:34:25 +00:00
length_too_long: "ITIN longer then required length",
length_too_short: "ITIN shorter then required length"
]
@spec message(error()) :: String.t()
def message(error) when error in @errors, do: @messages[error]
def message(_error), do: "Undefined error"
end