CoinError

Exception class carrying context about where and why an error occurred.

Exception class carrying context about where and why an error occurred.

Description

CoinError is thrown by COIN-OR code when an error condition is detected. It captures rich context for debugging:message: Description of what went wrongmethod: Name of the function that detected the errorclass: Name of the class (or a hint string for assertions)file: Source file name (for assertions)lineNumber: Source line (for assertions, -1 otherwise) Typical usage: throwCoinError("Matrixissingular","solve","CoinFactorization");

Public Methods

message

Get the error message text.

const std::string & message()

Returns: Description of what went wrong

methodName

Get the name of the method that threw this error.

const std::string & methodName()

Returns: Method/function name string

className

Get the class name or hint string.

const std::string & className()

Returns: Class name for regular errors, hint for assertions

fileName

Get the source file name (assertions only)

const std::string & fileName()

Returns: File name where assertion failed, empty for regular errors

lineNumber

Get the source line number (assertions only)

int lineNumber()

Returns: Line number where assertion failed, -1 for regular errors

print

Print error details to stdout.

void print(bool doPrint = true)

Parameters:

CoinError

Construct a CoinError with full context.

 CoinError(std::string message__, std::string methodName__, std::string className__, std::string fileName_ = std::string(), int line = -1)

Parameters:

CoinError

Copy constructor.

 CoinError(const CoinError & source)

Parameters:

operator=

Assignment operator.

CoinError & operator=(const CoinError & rhs)

Parameters:

Returns: Reference to this object

~CoinError

Destructor.

 ~CoinError()

Source

Header: layer-0/CoinUtils/src/CoinError.hpp