Deepsolver
Public Member Functions
ConfigException Class Reference

Indicates the error in configuration data. More...

Inheritance diagram for ConfigException:
DeepsolverException

List of all members.

Public Member Functions

 ConfigException (int code, const std::string &arg, const ConfigFilePosInfo &pos)
 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 the single-line configuration error description.
std::string getType () const
 Returns the string type of exception.

Detailed Description

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.

See also:
ConfigFileException ConfigCenter

Constructor & Destructor Documentation

ConfigException::ConfigException ( int  code,
const std::string &  arg,
const ConfigFilePosInfo pos 
) [inline]
Parameters:
[in]codeThe error code
[in]argOptional string error argument with meaning depending on error code
[in]posThe information about configuration file line the error is associated
ConfigException::ConfigException ( int  code,
const std::string &  arg 
) [inline]
Parameters:
[in]codeThe error code
[in]argOptional argument with meaning depending on error code

Member Function Documentation

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.

Returns:
The optional string argument of the error
int ConfigException::getCode ( ) const [inline]

Use this method to get the error code

Returns:
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.

Returns:
The file name with the invalid line
std::string ConfigException::getLine ( ) const [inline]

Use this method to get content of the line caused the configuration problem.

Returns:
The line caused 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.

Returns:
The number of the line caused the problem or zero if there is no any
std::string ConfigException::getMessage ( ) const [inline, virtual]

Using of these method is recommended only for debug purposes.

Returns:
The single-line error description

Implements DeepsolverException.

std::string ConfigException::getType ( ) const [inline, virtual]

This method always returns "configuration" string.

Returns:
The type of exception (always "configuration")

Implements DeepsolverException.