LSException Class

class localsolver::LSException

LocalSolver exception.

If an error occurred, LocalSolver throws a specific exception which contains useful info for debugging purposes.

Functions

LSException(LSErrorCode errorCode, const std::string &fileName, int lineNumber, const std::string &functionName, const std::string &explanation)

Constructor.

Parameters:
  • errorCode - The code associated to this exception.
  • fileName - Name of the LocalSolver source file where the exception is thrown.
  • lineNumber - Line number in the LocalSolver source file where the exception is thrown.
  • functionName - Name of the function where the exception is thrown.
  • explanation - An explanation about the exception.

virtual ~LSException()

Destructor.

const std::string &getFileName() const

Gets the name of the LocalSolver source file where the exception is thrown.

Only useful for LocalSolver’s maintenance team.

Return:File name.

int getLineNumber() const

Gets the line number in the LocalSolver source file where the exception is thrown.

Only useful for LocalSolver’s maintenance team.

Return:Line number.

const std::string &getFunctionName() const

Gets the name of the function where the exception is thrown.

Return:Function name.

const std::string &getExplanation() const

Gets the explanation about the exception.

Return:Explanation.

const std::string &getMessage() const

Returns a string message with all useful info about the current exception.

Return:Exception message.

LSErrorCode getErrorCode() const

Returns the error code associated to this exception.

Return:Error code.

const char *what() const

Returns a C-style string explanation about the current exception.

Return:Exception message.

const std::string &toString() const

Same as getMessage().