hutch_python.utils.safe_load¶
- hutch_python.utils.safe_load(name, cls=None)¶
Context manager to safely run a block of code.
This will abort running code and resume the rest of the program if something fails. This can be used to wrap user code with unknown behavior. This will log standard messages to indicate success or failure.
- Parameters:
name (
str
) – The name of the load to be logged. This will be used in the log message.cls (
type
, optional) – The class of a loaded object to be logged. This will be used in the log message.