From 48e95176b2fceb7fb5efb421ad77ec50d09631dd Mon Sep 17 00:00:00 2001 From: Henk van der Laan Date: Sat, 14 Apr 2018 10:22:59 +0200 Subject: [PATCH] Add more user friendly message to Connection#initialize This adds the cause for the exception as a message to this exception, making it more clear why this failed. --- src/mysql/connection.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mysql/connection.cr b/src/mysql/connection.cr index c48a345..64c91a7 100644 --- a/src/mysql/connection.cr +++ b/src/mysql/connection.cr @@ -28,8 +28,8 @@ class MySql::Connection < DB::Connection read_ok_or_err do |packet, status| raise "packet #{status} not implemented" end - rescue Errno - raise DB::ConnectionRefused.new + rescue ex : Errno + raise DB::ConnectionRefused.new(cause: ex, message: ex.message) end end