mirror of
https://github.com/yhirose/cpp-httplib
synced 2024-11-21 14:29:10 -07:00
add to_human_string (#1467)
* add to_human_string * replace to_string with to_human_string * fix test
This commit is contained in:
parent
7992b14896
commit
51607ec752
2 changed files with 14 additions and 14 deletions
26
httplib.h
26
httplib.h
|
@ -1665,20 +1665,20 @@ Server::set_idle_interval(const std::chrono::duration<Rep, Period> &duration) {
|
|||
|
||||
inline std::string to_string(const Error error) {
|
||||
switch (error) {
|
||||
case Error::Success: return "Success";
|
||||
case Error::Connection: return "Connection";
|
||||
case Error::BindIPAddress: return "BindIPAddress";
|
||||
case Error::Read: return "Read";
|
||||
case Error::Write: return "Write";
|
||||
case Error::ExceedRedirectCount: return "ExceedRedirectCount";
|
||||
case Error::Canceled: return "Canceled";
|
||||
case Error::SSLConnection: return "SSLConnection";
|
||||
case Error::SSLLoadingCerts: return "SSLLoadingCerts";
|
||||
case Error::SSLServerVerification: return "SSLServerVerification";
|
||||
case Error::Success: return "Success (no error)";
|
||||
case Error::Connection: return "Could not establish connection";
|
||||
case Error::BindIPAddress: return "Failed to bind IP address";
|
||||
case Error::Read: return "Failed to read connection";
|
||||
case Error::Write: return "Failed to write connection";
|
||||
case Error::ExceedRedirectCount: return "Maximum redirect count exceeded";
|
||||
case Error::Canceled: return "Connection handling canceled";
|
||||
case Error::SSLConnection: return "SSL connection failed";
|
||||
case Error::SSLLoadingCerts: return "SSL certificate loading failed";
|
||||
case Error::SSLServerVerification: return "SSL server verification failed";
|
||||
case Error::UnsupportedMultipartBoundaryChars:
|
||||
return "UnsupportedMultipartBoundaryChars";
|
||||
case Error::Compression: return "Compression";
|
||||
case Error::ConnectionTimeout: return "ConnectionTimeout";
|
||||
return "Unsupported HTTP multipart boundary characters";
|
||||
case Error::Compression: return "Compression failed";
|
||||
case Error::ConnectionTimeout: return "Connection timed out";
|
||||
case Error::Unknown: return "Unknown";
|
||||
default: break;
|
||||
}
|
||||
|
|
|
@ -596,7 +596,7 @@ TEST(ConnectionErrorTest, InvalidHostCheckResultErrorToString) {
|
|||
ASSERT_TRUE(!res);
|
||||
stringstream s;
|
||||
s << "error code: " << res.error();
|
||||
EXPECT_EQ("error code: Connection (2)", s.str());
|
||||
EXPECT_EQ("error code: Could not establish connection (2)", s.str());
|
||||
}
|
||||
|
||||
TEST(ConnectionErrorTest, InvalidPort) {
|
||||
|
|
Loading…
Reference in a new issue