Cbeam
|
Custom exception class for handling system-level errors in a cross-platform manner. More...
#include <system_error.hpp>
Public Member Functions | |
system_error (const std::string &message="") | |
Constructs a system_error using GetLastError() on Windows. | |
~system_error () override=default | |
Virtual destructor. | |
const char * | what () const noexcept override |
Returns the descriptive string of this error, using std::system_error::what(). | |
Public Member Functions inherited from cbeam::error::base_error | |
base_error ()=default | |
Default constructor. | |
~base_error () override=default | |
Virtual destructor. | |
const char * | what () const noexcept override |
Returns a generic explanatory string for all Cbeam base errors. | |
Custom exception class for handling system-level errors in a cross-platform manner.
The cbeam::error::system_error
class extends the standard std::system_error
by providing a constructor that automatically sets the appropriate error category and code based on the platform. This class simplifies the creation of system errors with custom messages while ensuring that the error codes and categories are consistent with the underlying operating system's conventions.
Inherits from cbeam::error::base_error and std::system_error via virtual inheritance. This ensures a single std::exception subobject when combined with other cbeam::error classes.
Usage: This class can be used to throw exceptions with detailed error messages, especially in scenarios where system calls fail. It automatically uses the correct error code and category without requiring them to be specified explicitly.
|
inlineexplicit |
Constructs a system_error using GetLastError() on Windows.
message | The message describing this system error. |
|
overridedefault |
Virtual destructor.
|
inlineoverridenoexcept |
Returns the descriptive string of this error, using std::system_error::what().