crystal-lang / crystal-mysql

MySQL connector for Crystal
MIT License
107 stars 36 forks source link

Add more user friendly message to Connection#initialize #55

Open helaan opened 6 years ago

helaan commented 6 years ago

This adds the cause for the exception as a message to this exception, making it more clear why this failed.

This saves a lot of debugging time when you have an issue with your database connection. As this is the first thing new users will do with this library, it is important to give users feedback on why this failed.

RX14 commented 6 years ago

To be honest, DB should probably not expose DB::ConnectionRefused at all, and just re-raise the cause exception when it catches DB::ConnectionRefused, prefixed with a message.