Exceptions

Exception types raised by ionworkspipeline.

class ionworkspipeline.exceptions.UserConfigurationError(*args, diagnostics: str | None = None)

Raised when a pipeline or element configuration is invalid.

Use it instead of a bare ValueError for anything the user fixes in their configuration. It subclasses ValueError so except ValueError handlers keep catching a raise ValueError that is upgraded to it.

Parameters

messagestr

Human-readable description of what is wrong, written for the end user.

diagnosticsstr or None, optional

Engineering detail kept out of the message, such as the traceback of the failure behind it. Keyword-only.

Extends: ValueError

class ionworkspipeline.exceptions.ModelError(*args, diagnostics: str | None = None)

Raised when a model fails to set up, discretise, initialise, or evaluate.

A UserConfigurationError subclass, which keeps the optimizer’s except ValueError NaN-fallback, but with its own MODEL kind so a model failure is reported as one rather than as generic configuration.

Parameters

messagestr

Human-readable description naming the objective and the underlying failure, written for the end user.

Extends: UserConfigurationError

class ionworkspipeline.exceptions.ParameterNotFoundError

Raised when a parameter key is not found in a pybamm ParameterValues lookup.

Subclasses KeyError so existing except KeyError handlers remain unaffected. The first positional argument is the human-readable message produced by pybamm’s FuzzyDict, e.g. "'Negative electrode loading [A.h.cm-2]' not found. Best matches are [...]".

Extends: KeyError

class ionworkspipeline.exceptions.AllStartsFailedError(message: str, *, child_failure: Failure | None = None, diagnostics: str | None = None, child_exception_type: str | None = None, child_message: str | None = None, child_error_code: str | None = None, child_log_url: str | None = None)

Raised when no fit is found: no start completed, or every evaluation failed.

Subclasses RuntimeError so existing except RuntimeError handlers remain unaffected. It takes the kind of the failure carried as child_failure, so the fit as a whole is classified the way that failure was: classify_failure() reads failure.

Parameters

messagestr

Summary of the total failure, written for the end user.

child_failureFailure or None, optional

The failure the fit is classified by: the first failed start’s when no start completed, otherwise the first error an evaluation raised. None when no start recorded an error (e.g. every start was canceled), which classifies the fit as internal.

diagnosticsstr or None, optional

Per-start statuses, costs and the first failure’s traceback, kept out of message.

child_exception_typestr or None, optional

Deprecated; use child_failure.exception_type.

child_messagestr or None, optional

Deprecated; use child_failure.message.

child_error_codestr or None, optional

Deprecated; use child_failure.kind.

child_log_urlstr or None, optional

Deep-link to the error-tracking event the failing start already captured, or None.

Extends: RuntimeError