Net++
A class-based C++ encapsulation over the POSIX Sockets API
Loading...
Searching...
No Matches
error.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <system_error>
4
5namespace netpp_error {
21 void throw_system_error(std::string what_arg);
22
28 void log_error(std::system_error &e);
29
30 namespace {
34 class GAIErrorCategory : public std::error_category {
36 const char *name() const noexcept override;
37 std::string message(int ev) const override;
39 };
40
45 class LibraryErrorCategory : public std::error_category {
47 const char *name() const noexcept override;
48 std::string message(int ev) const override;
50 };
51
52 }
53
60 void throw_gai_error(int &ev, std::string what_arg);
61
68 void throw_library_error(LibraryError code, std::string what_arg);
69} // namespace netpp_error
Definition error.hpp:5
void throw_gai_error(int &ev, std::string what_arg)
Throws an exception with gai_error category.
LibraryError
Enumeration representing the different error codes handled by LibraryErrorCategory.
Definition error.hpp:9
@ MissingAsyncContext
Definition error.hpp:12
@ BindFailed
Definition error.hpp:10
@ ConnectFailed
Definition error.hpp:11
void throw_library_error(LibraryError code, std::string what_arg)
Throws an exception with library_error category.
void log_error(std::system_error &e)
Prints the error to stdout.
void throw_system_error(std::string what_arg)
Throws an exception with std::generic category()