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 the error code.
std::string getComment () const
 Returns the developer error comment.
std::string getDescr () const
 The error description from the operating system.
std::string getMessage () const
 The full error description.
std::string getType () const
 Returns the 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 about error occurred. The error message consists of two parts: the short string provided by developer with any information hi want and the string given by the operating system. The developer can save in the string, for example, the name of system call with its arguments which execution failed.

See also:
Exception

Constructor & Destructor Documentation

SystemException::SystemException ( ) [inline]

This constructor implies automatic errno analyzing but without developer string, so the getMessage() method will return only the 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 with errno variable.

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

Using this constructor the developer 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]codeThe error code
SystemException::SystemException ( int  code,
const std::string &  comment 
) [inline]

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

Parameters:
[in]codeThe error code
[in]commentThe developer error additional information

Member Function Documentation

int SystemException::getCode ( ) const [inline]

This method returns the errno value got at exception creations.

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

This method returns the error comment provided by developer.

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

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

Returns:
The error description from the operating system
std::string SystemException::getMessage ( ) const [inline, virtual]

This method constructs complete error description using both the developer comment and the string description from the operating system. Usually this value is well-suited to be printed to user.

Returns:
The complete 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 other types of exceptions.

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

Implements DeepsolverException.