Deepsolver
Public Types | Public Member Functions
ConfigException Class Reference

Indicates the error in configuration data. More...

Inheritance diagram for ConfigException:
DeepsolverException

List of all members.

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 the single line error description.
std::string getType () const
 Returns the string with error type.

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 std::string &  fileName,
size_t  lineNumber,
const std::string &  line 
) [inline]
Parameters:
[in]codeThe error code
[in]argOptional string error argument with meaning dependent on error code
[in]fileNameThe name of the config file with the invalid line
[in]lineNumberThe number of the invalid line
[in]lineThe invalid line value
ConfigException::ConfigException ( int  code,
const std::string &  arg 
) [inline]
Parameters:
[in]codeThe error code
[in]argOptional argument with meaning dependent 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]

This method returns the 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.

Returns:
The single line error description

Implements DeepsolverException.

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

This method returns the short string with one or two words describing the error type. For example, this method can return values like "system", "rpm" etc. The value returned by this method usually is used for error message construction.

Returns:
The short string with error type description

Implements DeepsolverException.