Deepsolver
|
Indicates the error in configuration data. More...
Public Types | |
enum | { UnknownParam = 0, ValueCannotBeEmpty = 1, AddingNotPermitted = 2, InvalidBooleanValue = 3, InvalidUintValue = 4 } |
Public Member Functions | |
ConfigException (int code, const std::string &arg, const std::string &fileName, size_t lineNumber, const std::string &line) | |
The constructor. | |
ConfigException (int code, const std::string &arg) | |
The constructor with no configuration file line info. | |
std::string | getArg () const |
Returns the optional string argument of the error. | |
int | getCode () const |
Returns the error code. | |
std::string | getFileName () const |
Returns the name of the file associated with error position. | |
std::string | getLine () const |
Returns the line caused the configuration problem. | |
size_t | getLineNumber () const |
Returns number of the invalid line. | |
std::string | getMessage () const |
Returns a single line error description. | |
std::string | getType () const |
Returns a string with error type. |
This class instance indicates any problem in Deepsolver configuration structures. Be careful, it must not be confused with ConfigFileException used to notify about configuration file syntax errors.
The objects of ConfigException provide the error code, optional string argument which meaning depends on error code and error location in configuration files if there is any. Some kind of problems are actual without any reference to configuration file. For example, if some parameter is not set at all but its value is required.
ConfigException::ConfigException | ( | int | code, |
const std::string & | arg, | ||
const std::string & | fileName, | ||
size_t | lineNumber, | ||
const std::string & | line | ||
) | [inline] |
[in] | code | The error code |
[in] | arg | Optional string error argument with meaning dependent on error code |
[in] | fileName | The name of the config file with the invalid line |
[in] | lineNumber | The number of the invalid line |
[in] | line | The invalid line value |
ConfigException::ConfigException | ( | int | code, |
const std::string & | arg | ||
) | [inline] |
[in] | code | The error code |
[in] | arg | Optional argument with meaning dependent on error code |
std::string ConfigException::getArg | ( | ) | const [inline] |
Use this method to get string argument of the error. The meaning of this argument depends on error code and can be empty.
int ConfigException::getCode | ( | ) | const [inline] |
Use this method to get the error code
std::string ConfigException::getFileName | ( | ) | const [inline] |
Use this method to get name of the file with invalid line. string returned by this method can be empty because not all of the possible errors have associated place in configuration files. Before using the value returned by this method check the line number is greater than zero since in case of error without associated place the line number is always zero.
std::string ConfigException::getLine | ( | ) | const [inline] |
Use this method to get content of the line caused the configuration problem.
size_t ConfigException::getLineNumber | ( | ) | const [inline] |
Use this method to get 1-based number of the line caused the configuration problem. If this method returns zero it means there is no line associated with the problem.
std::string ConfigException::getMessage | ( | ) | const [inline, virtual] |
This method returns a single line string value with error description. Usually it is the value printed to user in error message. The value may not include error type since it can be obtained with getType() method.
Implements DeepsolverException.
std::string ConfigException::getType | ( | ) | const [inline, virtual] |
This method returns a short string with one or two words describing the error type. For example, this method can return values like "system", "back-end" etc. A value returned by this method usually is used for error message construction.
Implements DeepsolverException.