From c7c65bf4f540f0f481455ea7c0b1fe342e9c935f 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..32960cd 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(ex.message) end end