Cbeam
Loading...
Searching...
No Matches
cbeam::error::system_error Class Reference

Custom exception class for handling system-level errors in a cross-platform manner. More...

#include <system_error.hpp>

Inheritance diagram for cbeam::error::system_error:
Collaboration diagram for cbeam::error::system_error:

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.
 

Detailed Description

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.

Examples
cbeam/error/system_error.hpp.

Constructor & Destructor Documentation

◆ system_error()

cbeam::error::system_error::system_error ( const std::string & message = "")
inlineexplicit

Constructs a system_error using GetLastError() on Windows.

Parameters
messageThe message describing this system error.

◆ ~system_error()

cbeam::error::system_error::~system_error ( )
overridedefault

Virtual destructor.

Member Function Documentation

◆ what()

const char * cbeam::error::system_error::what ( ) const
inlineoverridenoexcept

Returns the descriptive string of this error, using std::system_error::what().


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