Deepsolver
|
The exception for system call errors. More...
Public Member Functions | |
void | accept (ExceptionVisitor &visitor) const |
Calls appropriate visitor method. | |
int | getCode () const |
Returns an error code. | |
std::string | getComment () const |
Returns developer error comment. | |
std::string | getDescr () const |
Returns the OS-generated error description associated with set errno. | |
std::string | getMessage () const |
Returns a single line error description. | |
std::string | getType () const |
Returns a string with short error type designation. | |
SystemException () | |
The default constructor. | |
SystemException (const std::string &comment) | |
The constructor 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. |
This class is used for indication of errors caused by various system calls problems. It automatically analyzes the 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 this string, for example, a name of failed system call with its arguments.
Deepsolver::SystemException::SystemException | ( | ) | [inline] |
This constructor implies automatic errno analyzing, but without developer-given string, so the getMessage() method will return only a single line description, provided by operating system.
Deepsolver::SystemException::SystemException | ( | const std::string & | comment | ) | [inline] |
This constructor allows developer to give short comment of the error with automatic adding a string from operating system, got through errno variable.
[in] | comment | A developer error comment |
Deepsolver::SystemException::SystemException | ( | int | code | ) | [inline] |
Using this constructor developer can provide any error code he wants without any additional comments. The operating system will be requested for error description using provided value . The developer must give the value, normally obtained through errno variable.
[in] | code | An error code |
Deepsolver::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.
[in] | code | An error code |
[in] | comment | A developer error additional information |
void Deepsolver::SystemException::accept | ( | ExceptionVisitor & | visitor | ) | const [inline, virtual] |
This method performs invocation of corresponding visit() method of the visitor, provided by the reference. You should use it each time, when you want to make particular handling action for various exception types, as it suggested by design pattern "visitor".
[in] | visitor | The reference to the visitor |
Implements Deepsolver::AbstractException.
int Deepsolver::SystemException::getCode | ( | ) | const [inline] |
std::string Deepsolver::SystemException::getComment | ( | ) | const [inline] |
std::string Deepsolver::SystemException::getDescr | ( | ) | const [inline] |
std::string Deepsolver::SystemException::getMessage | ( | ) | const [virtual] |
This method returns a single line string value with error description. Usually it is the value printed to user in the error message. The value should not include error type, since it can be obtained through getType() method.
Implements Deepsolver::AbstractException.
std::string Deepsolver::SystemException::getType | ( | ) | const [inline, virtual] |
This method returns a short string with one or two words describing the error type. For example, this method can return values like "system", "back-end" etc. A value returned by this method usually is used for error message construction.
Implements Deepsolver::AbstractException.