Skip to content

Commit

Permalink
TLS error messages improved (#93)
Browse files Browse the repository at this point in the history
* Fix typos

* Improve errors during TLS initialization
  • Loading branch information
alnr authored Sep 3, 2020
1 parent 4b8d2dc commit 59552fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/sw/redis++/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions src/sw/redis++/tls/tls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 59552fa

Please sign in to comment.