marEx.MarExError

exception marEx.MarExError(message, details=None, suggestions=None, error_code=None, context=None)[source]

Bases: Exception

Base exception class for all MarEx-specific errors.

This is the root of the MarEx exception hierarchy and provides common functionality for all marEx exceptions including:

  • Structured error context

  • Exception chaining support

  • Consistent error formatting

Parameters:
  • message (str) – Primary error message describing what went wrong

  • details (str, optional) – Additional technical details about the error

  • suggestions (list of str, optional) – Actionable suggestions for resolving the error

  • error_code (str, optional) – Structured error code for programmatic handling

  • context (dict, optional) – Additional context information (e.g., parameter values, data shapes)

Initialise the Error.

__init__(message, details=None, suggestions=None, error_code=None, context=None)[source]

Initialise the Error.

Parameters:
add_suggestion(suggestion)[source]

Add an additional suggestion for resolving the error.

Parameters:

suggestion (str)

Return type:

None

add_context(key, value)[source]

Add additional context information.

Parameters:
Return type:

None