ConfigFileException Class Reference

The exception object to indicate the configuration file parsing error. More...

Inheritance diagram for ConfigFileException:

VoicemanException

List of all members.

Public Types

enum  {
  InvalidSectionHeader = 1, EmptySectionName = 2, ParameterWithoutSection = 3, InvalidUnquotedValue = 4,
  InvalidLineBeginning = 5, InvalidParameterName = 6, InvalidCharAfterEquals = 7, UnexpectedLineEnd = 8,
  DublicatedKey = 9
}

Public Member Functions

 ConfigFileException (int code, const std::string &fileName, size_t line)
 The constructor with error code, file name and line number specification.
 ConfigFileException (int code)
 The constructor with error code only specification.
int getCode () const
 Returns error code.
std::string getDescr () const
 Returns the string with error description.
std::string getFileName () const
 Returns name of a file with error.
size_t getLine () const
 Returns line number.
std::string getMessage () const
 Returns exception description.
void makeLogReport (int level) const
 Makes report to logging system.
virtual ~ConfigFileException ()


Detailed Description

This class is used to indicate an error during configuration file parsing. It contains information about file name and line number with invalid string. Also it has general error code to produce error description. Usually this class notifies about syntax errors.

See also:
ConfigFileValueTypeException

Constructor & Destructor Documentation

ConfigFileException::ConfigFileException ( int  code  )  [inline]

Parameters:
[in] code The error code for new exception object

ConfigFileException::ConfigFileException ( int  code,
const std::string &  fileName,
size_t  line 
) [inline]

Parameters:
[in] code The error code for new exception object
[in] fileName Name of a file with error
[in] line The line number with error (must not be zero)

virtual ConfigFileException::~ConfigFileException (  )  [inline, virtual]

The destructor


Member Function Documentation

int ConfigFileException::getCode (  )  const [inline]

Use this method to get error code of current exception object.

Returns:
The error code of error occurred

std::string ConfigFileException::getDescr (  )  const [inline]

This method analyzes current error code and returns a string with corresponding error description.

std::string ConfigFileException::getFileName (  )  const [inline]

Use this method to get file name being processed.

Returns:
The name of a file with error occurred

size_t ConfigFileException::getLine (  )  const [inline]

This method has assert() to check current object was created through the constructor with line number specification.

Returns:
The line number with the error

std::string ConfigFileException::getMessage (  )  const [inline, virtual]

This method generates single line description of the error object. returned string can be printed to console or to log as error report.

Returns:
The single-line error description

Implements VoicemanException.

void ConfigFileException::makeLogReport ( int  level  )  const [inline, virtual]

This function writes to log a report about error object. It may be not exactly the same value as produced by getMessage() method. The level of message must be specified, because the same error can have different levels in different situations. For example, configuration file error is critical error during server startup process due to to requirement have first configuration information, but be just a usual error in configuration reloading, because in this case server can successfully use its previous configuration data.

Parameters:
level The level of error log report

Implements VoicemanException.


Generated on Wed Sep 29 16:40:41 2010 for VoiceMan by  doxygen 1.5.9