This project contains a Python library for describing Exasol error messages. This library lets you define errors with a uniform set of attributes. Furthermore, the error message is implemented to be parseable, so that you can extract an error catalog from the code.
pip install exasol-error-reporting
from exasol import error
error1 = error.ExaError(
"E-TEST-1", "A trivial error", "No mitigation available", {}
)
from exasol import error
error2 = error.ExaError(
"E-TEST-2",
message="Fire in the server room",
mitigations=[
"Use the fire extinguisher",
"Flood the room with halon gas (Attention: make sure no humans are in the room!)"
],
parameters={}
)
from exasol import error
error3 = error.ExaError(
"E-TEST-2",
"Not enough space on device {{device}}.",
"Delete something from {{device}}.",
{"device": "/dev/sda1"},
)
from exasol import error
from exasol.error import Parameter
error4 = error.ExaError(
"E-TEST-2",
"Not enough space on device {{device}}.",
"Delete something from {{device}}.",
{"device": Parameter("/dev/sda1", "name of the device")},
)
Check out the user guide for more details.
The exasol-error-reporting
library comes with a command line tool (ec
) which also can be invoked
by using its package/module entry point (python -m exasol.error
).
For detailed information about the usage consider consulting the help ec --help
or python -m exasol.error --help
.
ec parse some-python-file.py
ec parse < some-python-file.py
In order to generate a error-code-report compliant data file, you can use the generate subcommand.
ec generate NAME VERSION PACKAGE_ROOT > error-codes.json
For further details check out the project documentation.