Deepsolver
Public Member Functions
SystemException Class Reference

The exception for system call errors. More...

Inheritance diagram for SystemException:
DeepsolverException

List of all members.

Public Member Functions

int getCode () const
 Returns an error code.
std::string getComment () const
 Returns developer error comment.
std::string getDescr () const
 TA error description from the operating system.
std::string getMessage () const
 Returns a single line error description.
std::string getType () const
 Returns a type of an error.
 SystemException ()
 The default constructor.
 SystemException (const std::string &comment)
 The constructor with automatic errno analyzing with developer comment.
 SystemException (int code)
 The constructor with error code specification.
 SystemException (int code, const std::string &comment)
 The constructor with error code and comment specification.
virtual ~SystemException ()
 The destructor.

Detailed Description

This class is used for indication of errors caused by various system calls problems. It automatically analyzes value of system errno variable and can construct informative error description with text provided by operating system. An error message consists of two parts: the short string provided by developer with any information he wants and the string given by a operating system. Developer can save in string, for example, a name of failed system call with its arguments.


Constructor & Destructor Documentation

SystemException::SystemException ( ) [inline]

This constructor implies automatic errno analyzing but without developer string, so the getMessage() method will return only a single line description provided by operating system.

SystemException::SystemException ( const std::string &  comment) [inline]

This constructor allows developer to give short comment of the error and automatically add string from operating system got through errno variable.

Parameters:
[in]commentA developer error comment
SystemException::SystemException ( int  code) [inline]

Using this constructor tdeveloper can provide error code by himself without any additional comment. The operating system will be requested for error description using provided error code. The developer must give the value usually got through errno variable.

Parameters:
[in]codeAn error code
SystemException::SystemException ( int  code,
const std::string &  comment 
) [inline]

With this constructor developer can provide an error code to request description from operating system and any short comment he wants. The value of error code must be the value usually taken through errno variable.

Parameters:
[in]codeAn error code
[in]commentDeveloper error additional information

Member Function Documentation

int SystemException::getCode ( ) const [inline]

This method returns the errno value got at exception throwing.

Returns:
An erno value of corresponding error
std::string SystemException::getComment ( ) const [inline]

This method returns an error comment provided by developer.

Returns:
A developer error description
std::string SystemException::getDescr ( ) const [inline]

This method returns the error description from an operating system got by an errno value with strerror[] array.

Returns:
A error description from the operating system
std::string SystemException::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.

Returns:
A single line error description

Implements DeepsolverException.

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

This method always returns the "system" string. This string is used in error message construction and allows to distinguish the system errors from any other types of exceptions.

Returns:
The single word exception type ("system")

Implements DeepsolverException.