-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patherror.cpp
More file actions
30 lines (27 loc) · 1.14 KB
/
Copy patherror.cpp
File metadata and controls
30 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "error.hpp"
namespace pw {
namespace {
class PolywebCategory : public std::error_category {
public:
const char* name() const noexcept override {
return "polyweb";
}
std::string message(int error) const override {
switch (error) {
case PW_ERROR_INVALID_URL: return "Invalid URL";
case PW_ERROR_INVALID_HTTP: return "Invalid HTTP message";
case PW_ERROR_INVALID_WS: return "Invalid WebSocket message";
case PW_ERROR_LIMIT_EXCEEDED: return "Protocol limit exceeded";
case PW_ERROR_UNSUPPORTED: return "Unsupported protocol feature";
case PW_ERROR_PROXY_CONNECT_REJECTED: return "HTTP proxy rejected CONNECT request";
case PW_ERROR_WS_HANDSHAKE_REJECTED: return "WebSocket handshake rejected";
default: return "Unknown Polyweb error";
}
}
};
} // namespace
const std::error_category& polyweb_category() noexcept {
static PolywebCategory category;
return category;
}
} // namespace pw