Present a nicer error message when sql is down

Mr. Jinx

Active member
I have a forum setup where the sql database is running on a different (dedicated) server seperated from the forum web server.
This shouldn't happen to often, but when the sql database is down, or the server is rebooting after some updates, the user is presented with this nice error message:

An exception occurred: Connection refused in /home/..../public_html/library/Zend/Db/Adapter/Mysqli.php on line 333

Zend_Db_Adapter_Mysqli->_connect() in Zend/Db/Adapter/Abstract.php at line 315
Zend_Db_Adapter_Abstract->getConnection() in XenForo/Application.php at line 730
XenForo_Application->loadDb() in XenForo/Application.php at line 973
XenForo_Application->lazyLoad() in XenForo/Application.php at line 1004
XenForo_Application::get() in XenForo/Application.php at line 1632
XenForo_Application::getDb() in XenForo/Model.php at line 161
XenForo_Model->_getDb() in XenForo/Model/DataRegistry.php at line 138
XenForo_Model_DataRegistry->_getMultiFromDb() in XenForo/Model/DataRegistry.php at line 97
XenForo_Model_DataRegistry->getMulti() in XenForo/Dependencies/Abstract.php at line 147
XenForo_Dependencies_Abstract->preLoadData() in XenForo/FrontController.php at line 127
XenForo_FrontController->run() in /home/..../public_html/index.php at line 13
Would it be possible to replace this error message with a human readable message telling the user there is a problem with the database?