| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id: civicrm_error.module,v 1.1.2.1 2007/07/23 18:11:49 dalin Exp $ |
// $Id: civicrm_error.module,v 1.1.2.2 2007/07/23 18:13:52 dalin Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* Custom error function |
* Custom error function |
| 7 |
* Set CiviCRM » Administer CiviCRM » Global Settings » Debugging » Fatal Error Handler |
* Set CiviCRM » Administer CiviCRM » Global Settings » Debugging » Fatal Error Handler |
| 8 |
* To use this function |
* To use this function |
| 9 |
*/ |
*/ |
| 10 |
function civicrm_error_handler() { |
function civicrm_error_handler($civicrm_error) { |
| 11 |
|
|
| 12 |
$site = variable_get('site_name', 'drupal'); |
$site = variable_get('site_name', 'drupal'); |
| 13 |
|
|
| 14 |
// generate output |
// generate output |
| 15 |
$output .= 'There was a CiviCRM error at '. $site .".\n"; |
$output .= 'There was a CiviCRM error at '. $site .".\n"; |
| 16 |
|
|
| 17 |
// error details |
// civicrm error details |
| 18 |
|
if ($civicrm_error) { |
| 19 |
|
$output .= "\n\n***CIVICRM ERROR***\n"; |
| 20 |
|
$output .= _civicrm_error_parse_array($civicrm_error); |
| 21 |
|
} |
| 22 |
|
|
| 23 |
|
// php error details |
| 24 |
if (function_exists('error_get_last')) { |
if (function_exists('error_get_last')) { |
| 25 |
$output .= "\n\n***ERROR***\n"; |
$output .= "\n\n***PHP ERROR***\n"; |
| 26 |
$output .= _civicrm_error_parse_array(error_get_last()); |
$output .= _civicrm_error_parse_array(error_get_last()); |
| 27 |
} |
} |
| 28 |
elseif ($php_errormsg) { |
elseif ($php_errormsg) { |
| 29 |
$output .= "\n\n***ERROR***\n"; |
$output .= "\n\n***PHP ERROR***\n"; |
| 30 |
$output .= _civicrm_error_parse_array($php_errormsg); |
$output .= _civicrm_error_parse_array($php_errormsg); |
| 31 |
} |
} |
| 32 |
|
|