Skip to content

Commit 4373fc1

Browse files
committed
Updated error handling for general networking errors. Added a network_exception class.
1 parent 695e074 commit 4373fc1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

error/src/network/error.hpp

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
/**
1010
* \defgroup error Generic Error Handling
1111
*
12+
* This module contains a simple function that is used in generic
13+
* error handling inside cpp-netlib.
14+
*
1215
* \file
1316
* \brief Contains a set of error classes and exceptions for
1417
* network connections.
@@ -28,6 +31,31 @@ namespace network {
2831
* \endcode
2932
*/
3033
const std::error_category &network_category();
34+
35+
/**
36+
* \ingroup error
37+
* \class network_exception network/error.hpp
38+
* \brief An exception thrown in the event of a network error.
39+
*/
40+
class network_exception : public std::system_error {
41+
42+
public:
43+
44+
/**
45+
* \brief Constructor.
46+
* \param error_code The system error code.
47+
*/
48+
explicit network_exception(int error_code)
49+
: std::system_error(error_code, network_category()) {
50+
51+
}
52+
53+
/**
54+
* \brief Destructor.
55+
*/
56+
virtual ~network_exception() noexcept;
57+
58+
};
3159
} // namespace network
3260

3361
#endif // NETWORK_ERROR_INC

0 commit comments

Comments
 (0)