Net++
A class-based C++ encapsulation over the POSIX Sockets API
Loading...
Searching...
No Matches
netpp_error Namespace Reference

Enumerations

enum  LibraryError { BindFailed , ConnectFailed , MissingAsyncContext }
 Enumeration representing the different error codes handled by LibraryErrorCategory. More...
 

Functions

void throw_system_error (std::string what_arg)
 Throws an exception with std::generic category()
 
void log_error (std::system_error &e)
 Prints the error to stdout.
 
void throw_gai_error (int &ev, std::string what_arg)
 Throws an exception with gai_error category.
 
void throw_library_error (LibraryError code, std::string what_arg)
 Throws an exception with library_error category.
 

Enumeration Type Documentation

◆ LibraryError

Enumeration representing the different error codes handled by LibraryErrorCategory.

Enumerator
BindFailed 
ConnectFailed 
MissingAsyncContext 

Function Documentation

◆ log_error()

void netpp_error::log_error ( std::system_error &  e)

Prints the error to stdout.

Parameters
eThe system error thrown

◆ throw_gai_error()

void netpp_error::throw_gai_error ( int &  ev,
std::string  what_arg 
)

Throws an exception with gai_error category.

Parameters
evThe resulting error code from a getaddrinfo() call
what_argThe explanation of the error

◆ throw_library_error()

void netpp_error::throw_library_error ( LibraryError  code,
std::string  what_arg 
)

Throws an exception with library_error category.

Parameters
codeThe error code pertaining to the library error
what_argThe explanation of the error

◆ throw_system_error()

void netpp_error::throw_system_error ( std::string  what_arg)

Throws an exception with std::generic category()

Constructs a system error with errno, std::generic_category, and the passed what_arg, and throws the error

Parameters
what_argAn explanatory string passed as a substring to the exception's what()