diff --git a/README.md b/README.md index b2712a5..2a3d5ed 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # tomlantic > [!WARNING] -> tomlantic is at 0.1.2 and currently, only i use it myself. it isn't battle tested, +> tomlantic is at 0.1.3 and currently, only i use it myself. it isn't battle tested, > so issues may arise. > if you're willing to run into potential bugs and issues, feel free to use it! @@ -191,7 +191,10 @@ base exception class for all tomlantic errors - attributes: - loc: `tuple[str, ...]` the location of the error in the toml document - example: `('settings', 'name')` + example: `('settings', 'name') = settings.name` + + - msg: `str` + the error 'message' (if any) - pydantic_error: [`pydantic_core.ErrorDetails`](https://docs.pydantic.dev/latest/api/pydantic_core/#pydantic_core.ErrorDetails) the original pydantic error, this is what you see in the list of errors when you diff --git a/pyproject.toml b/pyproject.toml index ada23ed..be8f89d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,11 @@ [tool.poetry] name = "tomlantic" -version = "0.1.2" +version = "0.1.3" description = "marrying pydantic models and tomlkit documents" authors = ["Mark Joshwel "] license = "Unlicense" readme = "README.md" +include = ["README.md"] [tool.poetry.dependencies] python = "^3.8" diff --git a/tomlantic/tomlantic.py b/tomlantic/tomlantic.py index 57e3f9a..d0cd1f8 100644 --- a/tomlantic/tomlantic.py +++ b/tomlantic/tomlantic.py @@ -144,9 +144,17 @@ class TomlanticException(Exception): class TOMLBaseSingleError(TomlanticException): - """base exception class for single errors, e.g. TOMLMissingError, TOMLValueError""" + """ + base exception class for single errors, e.g. TOMLMissingError, TOMLValueError + + attributes: + - loc: `tuple[str]` + - msg: `str` + - pydantic_error: `pydantic_core.ErrorDetails` + """ loc: Tuple[str, ...] + msg: str = "" pydantic_error: ErrorDetails def __init__( @@ -158,6 +166,7 @@ def __init__( self.loc = loc self.pydantic_error = pydantic_error super().__init__(*args) + self.msg = str(self) class TOMLMissingError(TOMLBaseSingleError):