}
// create the error array
- $error = array();
- $error['callback'] = $pearError->getCallback();
- $error['code'] = $pearError->getCode();
- $error['message'] = $pearError->getMessage();
- $error['mode'] = $pearError->getMode();
- $error['debug_info'] = $pearError->getDebugInfo();
- $error['type'] = $pearError->getType();
- $error['user_info'] = $pearError->getUserInfo();
- $error['to_string'] = $pearError->toString();
+ $error = self::getErrorDetails($pearError);
// We access connection info via _DB_DATAOBJECT instead
// of, e.g., calling getDatabaseConnection(), so that we
*/
public static function simpleHandler($pearError) {
+ $error = self::getErrorDetails($pearError);
+
+ // ensure that debug does not check permissions since we are in bootstrap
+ // mode and need to print a decent message to help the user
+ CRM_Core_Error::debug('Initialization Error', $error, TRUE, TRUE, FALSE);
+
+ // always log the backtrace to a file
+ self::backtrace('backTrace', TRUE);
+
+ exit(0);
+ }
+
+ /**
+ * this function is used to return error details
+ *
+ * @param $pearError
+ *
+ * @return array $error
+ */
+ public static function getErrorDetails($pearError) {
// create the error array
$error = array();
$error['callback'] = $pearError->getCallback();
$error['user_info'] = $pearError->getUserInfo();
$error['to_string'] = $pearError->toString();
- // ensure that debug does not check permissions since we are in bootstrap
- // mode and need to print a decent message to help the user
- CRM_Core_Error::debug('Initialization Error', $error, TRUE, TRUE, FALSE);
-
- // always log the backtrace to a file
- self::backtrace('backTrace', TRUE);
-
- exit(0);
+ return $error;
}
/**
* @throws PEAR_Exception
*/
public static function exceptionHandler($pearError) {
+ CRM_Core_Error::debug_var('Fatal Error Details', self::getErrorDetails($pearError));
CRM_Core_Error::backtrace('backTrace', TRUE);
throw new PEAR_Exception($pearError->getMessage(), $pearError);
}