diff --git a/_clang-format b/_clang-format index bb15149..f60acee 100644 --- a/_clang-format +++ b/_clang-format @@ -51,7 +51,8 @@ CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerIndentWidth: 4 ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true +# Cpp11BracedListStyle: true +Cpp11BracedListStyle: false DerivePointerAlignment: false DisableFormat: false ExperimentalAutoDetectBinPacking: false diff --git a/examples/client_basics.cc b/examples/client_basics.cc index ac1a2e8..79beae4 100644 --- a/examples/client_basics.cc +++ b/examples/client_basics.cc @@ -59,7 +59,7 @@ int main() { #endif // WEBCC_ENABLE_SSL } catch (const webcc::Error& error) { - std::cout << error << std::endl; + std::cerr << error << std::endl; } return 0; diff --git a/webcc/client.cc b/webcc/client.cc index 5c42eee..0aefda7 100644 --- a/webcc/client.cc +++ b/webcc/client.cc @@ -78,7 +78,7 @@ void Client::Connect(RequestPtr request) { DoConnect(request, "443"); #else LOG_ERRO("SSL/HTTPS support is not enabled."); - return kSyntaxError; + error_.Set(Error::kSyntaxError, "SSL/HTTPS is not supported"); #endif // WEBCC_ENABLE_SSL } else { socket_.reset(new Socket{ io_context_ }); diff --git a/webcc/globals.cc b/webcc/globals.cc index e6cb12a..55a5e1c 100644 --- a/webcc/globals.cc +++ b/webcc/globals.cc @@ -47,8 +47,9 @@ std::string FromExtension(const std::string& extension, // ----------------------------------------------------------------------------- std::ostream& operator<<(std::ostream& os, const Error& error) { + os << "ERROR("; os << std::to_string(static_cast(error.code())); - os << ": " << error.message(); + os << "): " << error.message(); if (error.timeout()) { os << " (timeout)"; } diff --git a/webcc/logger.cc b/webcc/logger.cc index d807c08..533fb5a 100644 --- a/webcc/logger.cc +++ b/webcc/logger.cc @@ -97,6 +97,7 @@ static const bool g_terminal_has_color = []() { return strcmp(term, "cygwin") == 0 || strcmp(term, "linux") == 0 || strcmp(term, "rxvt-unicode-256color") == 0 || strcmp(term, "screen") == 0 || strcmp(term, "screen-256color") == 0 || + strcmp(term, "screen.xterm-256color") == 0 || strcmp(term, "tmux-256color") == 0 || strcmp(term, "xterm") == 0 || strcmp(term, "xterm-256color") == 0 || strcmp(term, "xterm-termite") == 0 || strcmp(term, "xterm-color") == 0;