Skip to content

Enhancements to exceptions and BE, LU formatters - #13

Merged
BenMorel merged 9 commits into
brick:masterfrom
ruben9227:master
Oct 8, 2024
Merged

BenMorel merged 9 commits into
brick:masterfrom
ruben9227:master

Conversation

@ruben9227

Copy link
Copy Markdown
Contributor
  • Adds getters to exception objects for easier use, for instance for displaying translated error messages to the user on a higher level, then it's nice you can grab just the postcode instead of the total exception message.

  • Implements a helper trait to strip off Country code prefixes from postalcodes:

In some countries like Belgium or Luxembourg its common to provide a country code prefix in a postalcode, although the format is incorrect, many government agencies, businesses and people still use this. See: https://en.wikipedia.org/wiki/Postal_codes_in_Belgium Rather than failing this format into an exception, this helper class strips the prefix off before validating it, thus providing you with the correct format without the country code prefix in it.

Of course a helper is not necessarily needed, but this prevents duplicate lines of code in the project and allows for other helpers to be shared across formatters.

Let me know what you guys think.

ruben9227 added