Deepsolver
|
Indicates an error in configuration data. More...
Classes | |
struct | Descr |
Public Types | |
enum | { UnknownOption, ValueCannotBeEmpty, AddingNotPermitted, InvalidBooleanValue, InvalidIntValue, InvalidUIntValue, InvalidUrl, CodeCount } |
Public Member Functions | |
void | accept (ExceptionVisitor &visitor) const |
Calls appropriate visitor method. | |
ConfigException (int code, const StringVector &path, const std::string §Arg, const std::string &line, const std::string &fileName, size_t lineNumber) | |
The constructor. | |
int | getCode () const |
Returns the error code. | |
std::string | getFileName () const |
Returns a file name with an invalid line. | |
std::string | getLine () const |
Returns an invalid line value. | |
size_t | getLineNumber () const |
Returns number of a invalid line. | |
std::string | getLocationDesignation () const |
Returns full designation of configuration problem location. | |
std::string | getMessage () const |
Returns a single line error description. | |
std::string | getOptionDesignation () const |
Returns a string designation of a configuration option with an invalid value. | |
const StringVector & | getPath () const |
Returns a configuration option path. | |
std::string | getSectArg () const |
Returns a first-level section argument. | |
std::string | getType () const |
Returns a string with short error type designation. | |
virtual | ~ConfigException () |
The destructor. | |
Static Public Member Functions | |
static std::string | getDescr (int code) |
Generates English problem description by the given code. |
This class instance indicates any problem in Deepsolver configuration structures. Be careful, it must be not confused with ConfigFileException, used to notify about configuration file syntax errors.
The objects of ConfigException provide the error code, option path with section argument if needed and error location in configuration file if there is any. Note, some sort of problems are still meaningful even without any reference to location in a configuration file.
Deepsolver::ConfigException::ConfigException | ( | int | code, |
const StringVector & | path, | ||
const std::string & | sectArg, | ||
const std::string & | line, | ||
const std::string & | fileName, | ||
size_t | lineNumber | ||
) | [inline] |
[in] | code | The error code |
[in] | path | A value path |
[in] | sectArg | An argument for first-level section |
[in] | line | An invalid line value |
[in] | fileName | The name of the config file with the invalid line |
[in] | lineNumber | A number of the invalid line |
void Deepsolver::ConfigException::accept | ( | ExceptionVisitor & | visitor | ) | const [inline, virtual] |
This method performs invocation of corresponding visit() method of the visitor, provided by the reference. You should use it each time, when you want to make particular handling action for various exception types, as it suggested by design pattern "visitor".
[in] | visitor | The reference to the visitor |
Implements Deepsolver::AbstractException.
int Deepsolver::ConfigException::getCode | ( | ) | const [inline] |
static std::string Deepsolver::ConfigException::getDescr | ( | int | code | ) | [inline, static] |
[in] | code | The error code to generate description for |
std::string Deepsolver::ConfigException::getFileName | ( | ) | const [inline] |
std::string Deepsolver::ConfigException::getLine | ( | ) | const [inline] |
size_t Deepsolver::ConfigException::getLineNumber | ( | ) | const [inline] |
Use this method to get 1-based number of an invalid line. If this method returns 0 that means the error is not associated with any location in configuration files.
std::string Deepsolver::ConfigException::getLocationDesignation | ( | ) | const [inline] |
This method constructs string with unique designation of a place causing configuration problem. This information usually includes file name and line number.
std::string Deepsolver::ConfigException::getMessage | ( | ) | const [virtual] |
This method returns a single line string value with error description. Usually it is the value printed to user in the error message. The value should not include error type, since it can be obtained through getType() method.
Implements Deepsolver::AbstractException.
std::string Deepsolver::ConfigException::getOptionDesignation | ( | ) | const [inline] |
const StringVector& Deepsolver::ConfigException::getPath | ( | ) | const [inline] |
std::string Deepsolver::ConfigException::getSectArg | ( | ) | const [inline] |
std::string Deepsolver::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 Deepsolver::AbstractException.