Skip to content

Exceptions

ropt.exceptions

Exceptions raised within the ropt library.

StepAborted

Bases: Exception

Raised when a step is aborted prematurely.

This exception signals that a plan step could not complete its intended task due to a specific condition (e.g., insufficient valid realizations, user request).

It must be initialized with an ExitCode indicating the reason for the abortion.

__init__

__init__(exit_code: ExitCode) -> None

Initialize the StepAborted exception.

Stores the reason for the abortion, which can be accessed via the exit_code attribute.

Parameters:

Name Type Description Default
exit_code ExitCode

The code indicating why the optimization step was aborted.

required

PlanAborted

Bases: Exception

Raised when an optimization plan is aborted prematurely.

This exception signals that the execution of a Plan was stopped before completion. This typically occurs when a step or event handler within the plan explicitly sets the plan's aborted flag (e.g., due to a user request via a signal or an unrecoverable error condition detected by an event handler).

Any subsequent attempts to execute further steps in an already aborted plan will raise this exception.