jsocketpp 1.0
A cross-platform C++20 socket library.
Loading...
Searching...
No Matches
SocketException.hpp
Go to the documentation of this file.
1
5
6#pragma once
7
8#include "common.hpp"
9
10#include <exception>
11#include <stdexcept>
12#include <string>
13
14namespace jsocketpp
15{
16
57class SocketException : public std::runtime_error, public std::nested_exception
58{
59 public:
60 explicit SocketException(const int code, const std::string& message = "SocketException")
61 : std::runtime_error(message + " (" + std::to_string(code) + ")"), _errorCode(code)
62 {
63 }
64
65 [[nodiscard]] int getErrorCode() const noexcept { return _errorCode; }
66
67 ~SocketException() override = default;
68
69 private:
71};
72
73} // namespace jsocketpp
int getErrorCode() const noexcept
Definition SocketException.hpp:65
SocketException(const int code, const std::string &message="SocketException")
Definition SocketException.hpp:60
~SocketException() override=default
int _errorCode
Definition SocketException.hpp:70
Common platform and utility includes for jsocketpp.
A C++ socket library providing Java-style networking interfaces.
Definition BufferView.hpp:13