Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
Classes | |
class | _StatusCode |
class | InternalMathOptError |
Functions | |
Optional[Exception] | status_proto_to_exception (rpc_pb2.StatusProto status_proto) |
Translate C++'s absl::Status errors to Python standard errors. Here we try to use the standard Python errors we would use if the C++ code was instead implemented in Python. This will give Python users a more familiar API.
Optional[Exception] ortools.math_opt.python.errors.status_proto_to_exception | ( | rpc_pb2.StatusProto | status_proto | ) |
Returns the Python exception that best match the input absl::Status. There are some Status that we expect the MathOpt code to return, for those the matching exceptions are: - InvalidArgument: ValueError - FailedPrecondition: AssertionError - Unimplemented: NotImplementedError - Internal: InternalMathOptError Other Status's are not used by MathOpt, if they are seen a InternalMathOptError is raised (as if the Status was Internal) and the error message contains the unexpected code. Args: status_proto: The input proto to convert to an exception. Returns: The corresponding exception. None if the input status is OK.