Length checks added, validations added

This commit is contained in:
2024-05-10 17:56:29 -04:00
parent 51c5c1d800
commit 4447a10bf2
6 changed files with 144 additions and 71 deletions

View File

@@ -7,6 +7,8 @@ defmodule IbanEx.Error do
| :invalid_length
| :invalid_checksum
| :can_not_parse_map
| :length_to_long
| :length_to_short
| atom()
@type errors() :: [error()]
@errors [
@@ -14,15 +16,19 @@ defmodule IbanEx.Error do
:invalid_format,
:invalid_length,
:invalid_checksum,
:can_not_parse_map
]
:can_not_parse_map,
:length_to_long,
:length_to_short
]
@messages [
unsupported_country_code: "Unsupported country code",
invalid_format: "IBAN violates required format",
invalid_length: "IBAN violates the required length",
invalid_checksum: "IBAN's checksum is invalid",
can_not_parse_map: "Can't parse map to IBAN struct"
can_not_parse_map: "Can't parse map to IBAN struct",
length_to_long: "IBAN longer then required length",
length_to_short: "IBAN shorter then required length"
]
@spec message(error()) :: String.t()