ConfZ icon indicating copy to clipboard operation
ConfZ copied to clipboard

Wrap pydantic's validation error

Open silvanmelchior opened this issue 4 years ago • 0 comments

If validation of a config class fails, the exception is raised by pydantic and not touched by confz at all. At the same time, confz might raise exceptions if the config could not be loaded or merged in the first place (e.g. a missing config file). Thus, the user has to catch both exceptions to react accordingly.

An alternative would be if confz catches the error of pydantic and raises its own exception, inheriting from ConfZException. This would allow the user to only catch a single exception.

silvanmelchior avatar Oct 20 '21 14:10 silvanmelchior