better handling of PEAR errors

This commit is contained in:
Evan Prodromou 2009-06-14 14:01:11 -07:00
parent 7f76c36f24
commit 9addfeacfd

View File

@ -48,13 +48,18 @@ function handleError($error)
$logmsg .= " : ". $error->getDebugInfo(); $logmsg .= " : ". $error->getDebugInfo();
} }
common_log(LOG_ERR, $logmsg); common_log(LOG_ERR, $logmsg);
$msg = sprintf(_('The database for %s isn\'t responding correctly, '. if ($error instanceof DB_DataObject_Error) {
'so the site won\'t work properly. '. $msg = sprintf(_('The database for %s isn\'t responding correctly, '.
'The site admins probably know about the problem, '. 'so the site won\'t work properly. '.
'but you can contact them at %s to make sure. '. 'The site admins probably know about the problem, '.
'Otherwise, wait a few minutes and try again.'), 'but you can contact them at %s to make sure. '.
common_config('site', 'name'), 'Otherwise, wait a few minutes and try again.'),
common_config('site', 'email')); common_config('site', 'name'),
common_config('site', 'email'));
} else {
$msg = _('An important error occured, probably related to email setup. '.
'Check logfiles for more info..');
}
$dac = new DBErrorAction($msg, 500); $dac = new DBErrorAction($msg, 500);
$dac->showPage(); $dac->showPage();