From 59552fa6c49dddffc20f8eb32f8c8f00ff2daed1 Mon Sep 17 00:00:00 2001 From: alnr Date: Thu, 3 Sep 2020 16:50:33 +0200 Subject: [PATCH] TLS error messages improved (#93) * Fix typos * Improve errors during TLS initialization --- src/sw/redis++/connection.cpp | 4 ++-- src/sw/redis++/tls/tls.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sw/redis++/connection.cpp b/src/sw/redis++/connection.cpp index e135a5b9..354e5afa 100644 --- a/src/sw/redis++/connection.cpp +++ b/src/sw/redis++/connection.cpp @@ -289,7 +289,7 @@ Connection::ContextUPtr Connection::Connector::_connect() const { default: // Never goes here. - throw Error("Unkonw connection type"); + throw Error("Unknown connection type"); } if (context == nullptr) { @@ -362,7 +362,7 @@ Connection::Connection(const ConnectionOptions &opts) : assert(_ctx && !broken()); const auto &tls_opts = opts.tls; - // If not complied with TLS, TLS is always disabled. + // If not compiled with TLS, TLS is always disabled. if (tls::enabled(tls_opts)) { _tls_ctx = tls::secure_connection(*_ctx, tls_opts); } diff --git a/src/sw/redis++/tls/tls.cpp b/src/sw/redis++/tls/tls.cpp index 1cb49d6f..1ee4309d 100644 --- a/src/sw/redis++/tls/tls.cpp +++ b/src/sw/redis++/tls/tls.cpp @@ -54,12 +54,12 @@ TlsContextUPtr secure_connection(redisContext &ctx, const TlsOptions &opts) { c_str(opts.sni), &err)); if (!tls_ctx) { - throw Error(std::string("failed to create TSL context, err: ") + throw Error(std::string("failed to create TLS context: ") + redisSSLContextGetError(err)); } if (redisInitiateSSLWithContext(&ctx, tls_ctx.get()) != REDIS_OK) { - throw Error("failed to initialize connection with TSL"); + throw_error(ctx, "Failed to initialize TLS connection"); } return tls_ctx;