Exasol Error Reporting

1.1.0 · active · verified Fri Apr 17

Exasol Error Reporting is a Python library designed to standardize error messages with structured error codes, messages, and mitigation hints. It ensures uniformity across applications by enforcing a specific error code format. The current version is 1.1.0, and it follows an active release cadence, typically updating dependencies and addressing security concerns as needed.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define and raise an `ExaError` with a structured error code, message, mitigation hints, and additional parameters. It also shows how to catch and inspect the `ExaError` object.

from exasol.error_reporting import ExaError

def my_faulty_function(param_value):
    if param_value is None:
        raise ExaError("E-TEST-1", "Input parameter 'param_value' must not be None.") \
            .add_mitigation("Provide a valid non-null value for 'param_value'.") \
            .add_parameter("received_value", "None")
    return f"Processed: {param_value}"

# Example Usage:
try:
    my_faulty_function(None)
except ExaError as e:
    print(f"Caught ExaError: {e.error_code} - {e.message}")
    for mitigation in e.mitigations:
        print(f"  Mitigation: {mitigation}")
    for param, value in e.parameters.items():
        print(f"  Parameter {param}: {value}")

try:
    result = my_faulty_function("hello")
    print(result)
except ExaError as e:
    print(f"Unexpected error: {e}")

view raw JSON →