function _new_relic_rpm_exception_handler in New Relic 7
Provides custom PHP exception handling.
Will invoke newrelic_notice_error() to forward the exception to New Relic.
Parameters
object $exception: The exception object that was thrown.
1 string reference to '_new_relic_rpm_exception_handler'
- new_relic_rpm_init in ./
new_relic_rpm.module - Implements hook_init().
File
- ./
new_relic_rpm.module, line 182 - Drupal module implementing New Relic.
Code
function _new_relic_rpm_exception_handler($exception) {
require_once DRUPAL_ROOT . '/includes/errors.inc';
try {
// Forward the exception to New Relic.
newrelic_notice_error(NULL, $exception);
// Set flag to prevent duplicate logging by watchdog.
$arr_error = _drupal_decode_exception($exception);
$arr_error['new_relic_already_logged'] = TRUE;
// Log the message to the watchdog and return an error page to the user.
_drupal_log_error($arr_error, TRUE);
} catch (Exception $exception2) {
// Another uncaught exception was thrown while handling the first one.
// If we are displaying errors, then do so with no possibility of a further
// uncaught exception being thrown.
if (error_displayable()) {
print '<h1>Additional uncaught exception thrown while handling exception.</h1>';
print '<h2>Original</h2><p>' . _drupal_render_exception_safe($exception) . '</p>';
print '<h2>Additional</h2><p>' . _drupal_render_exception_safe($exception2) . '</p><hr />';
}
}
}