CppCommon  1.0.4.1
C++ Common Library
Public Member Functions | Protected Attributes | List of all members
CppCommon::SystemException Class Reference

System exception. More...

#include <exceptions.h>

Inheritance diagram for CppCommon::SystemException:
CppCommon::Exception CppCommon::FileSystemException CppCommon::DLLException

Public Member Functions

 SystemException ()
 Create system exception based on the last system error code. More...
 
 SystemException (int error)
 Create system exception based on the given system error code. More...
 
 SystemException (const std::string &message)
 Create system exception based on the given exception message. More...
 
 SystemException (const std::string &message, int error)
 Create system exception based on the given exception message and system error code. More...
 
int system_error () const noexcept
 Get system error code. More...
 
const std::string & system_message () const noexcept
 Get system error message. More...
 
std::string string () const override
 Get string from the current system exception. More...
 
- Public Member Functions inherited from CppCommon::Exception
 Exception (const std::string &message="")
 Default class constructor. More...
 
 Exception (const Exception &)=default
 
 Exception (Exception &&)=default
 
virtual ~Exception ()=default
 
Exceptionoperator= (const Exception &)=default
 
Exceptionoperator= (Exception &&)=default
 
const std::string & message () const noexcept
 Get exception message. More...
 
const SourceLocationlocation () const noexcept
 Get exception location. More...
 
const char * what () const noexcept override
 Get string identifying exception. More...
 

Protected Attributes

int _system_error
 System error code. More...
 
std::string _system_message
 System error message. More...
 
- Protected Attributes inherited from CppCommon::Exception
std::string _cache
 Cached exception string. More...
 
std::string _message
 Exception message. More...
 
SourceLocation _location
 Exception location. More...
 

Detailed Description

System exception.

Examples
threads_named_critical_section.cpp, threads_named_mutex.cpp, threads_named_rw_lock.cpp, threads_named_semaphore.cpp, and threads_semaphore.cpp.

Definition at line 106 of file exceptions.h.

Constructor & Destructor Documentation

◆ SystemException() [1/4]

CppCommon::SystemException::SystemException ( )
inline

Create system exception based on the last system error code.

Definition at line 110 of file exceptions.h.

◆ SystemException() [2/4]

CppCommon::SystemException::SystemException ( int  error)
inlineexplicit

Create system exception based on the given system error code.

Parameters
error- System error code

Definition at line 117 of file exceptions.h.

◆ SystemException() [3/4]

CppCommon::SystemException::SystemException ( const std::string &  message)
inlineexplicit

Create system exception based on the given exception message.

Parameters
message- Exception message

Definition at line 124 of file exceptions.h.

◆ SystemException() [4/4]

CppCommon::SystemException::SystemException ( const std::string &  message,
int  error 
)
inlineexplicit

Create system exception based on the given exception message and system error code.

Parameters
message- Exception message
error- System error code

Definition at line 132 of file exceptions.h.

Member Function Documentation

◆ string()

std::string CppCommon::SystemException::string ( ) const
overridevirtual

Get string from the current system exception.

Reimplemented from CppCommon::Exception.

Reimplemented in CppCommon::FileSystemException.

Definition at line 43 of file exceptions.cpp.

◆ system_error()

int CppCommon::SystemException::system_error ( ) const
inlinenoexcept

Get system error code.

Definition at line 139 of file exceptions.h.

◆ system_message()

const std::string& CppCommon::SystemException::system_message ( ) const
inlinenoexcept

Get system error message.

Definition at line 141 of file exceptions.h.

Member Data Documentation

◆ _system_error

int CppCommon::SystemException::_system_error
protected

System error code.

Definition at line 148 of file exceptions.h.

◆ _system_message

std::string CppCommon::SystemException::_system_message
protected

System error message.

Definition at line 150 of file exceptions.h.


The documentation for this class was generated from the following files: