marEx.wrap_exception

marEx.wrap_exception(original_exception, message=None, marex_exception_type=None)[source]

Wrap a generic exception in an appropriate MarEx exception.

This function helps maintain backward compatibility while migrating to the new exception hierarchy by wrapping generic exceptions in appropriate MarEx-specific exceptions.

Parameters:
  • original_exception (Exception) – The original exception to wrap

  • message (str, optional) – Custom message (uses original message if not provided)

  • marex_exception_type (type, optional) – Specific MarEx exception type to use

Returns:

Wrapped exception with original as cause

Return type:

MarExError