gtopt/lp_build_error.hpp file

Single failure channel for add_to_lp (LP assembly errors).

Failure policy for LP assembly (XLP::add_to_lp):

  • An add_to_lp either succeeds (return true) or fails HARD. A return false is never a silent skip: the driver (system_lp.cpp::add_to_lp) turns it into an LpBuildError.
  • Element code reports a failure ONE way, through fail_lp:

    fail_lp(*this, scenario, stage,
            {.field = "capacity",
             .value = "unset",
             .expected = "capacity or expansion on the generator"});
    
  • Any other exception escaping an element's add_to_lp (runtime, logic, bad_optional_access, …) is caught ONCE by the driver and re-thrown as an LpBuildError carrying the element context (class, uid, name, scenario, stage) plus the original message, so a half-built element can never be silently skipped.

LpBuildError derives from std::runtime_error, so every existing catch (const std::runtime_error&) / catch (const std::exception&) up the call chain keeps working.

Namespaces

namespace gtopt
namespace gtopt::detail

Classes

class gtopt::LpBuildError
The single exception type of the LP-assembly failure channel.
struct gtopt::LpBuildErrorInfo
Structured context of one LP-assembly failure.
struct gtopt::LpFailure