Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-30434 core: modified get_exception_info() to provide more debug i…

…nformation
  • Loading branch information...
commit fb71453ddca4ddd73dfcce8033d57cb1a3a5e139 1 parent e16e230
@andyjdavis andyjdavis authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 lib/setuplib.php
View
7 lib/setuplib.php
@@ -489,6 +489,9 @@ function get_exception_info($ex) {
$debuginfo = null;
}
+ // Append the error code to the debug info to make grepping and googling easier
+ $debuginfo .= PHP_EOL."Error code: $errorcode";
+
$backtrace = $ex->getTrace();
$place = array('file'=>$ex->getFile(), 'line'=>$ex->getLine(), 'exception'=>get_class($ex));
array_unshift($backtrace, $place);
@@ -497,6 +500,8 @@ function get_exception_info($ex) {
if (empty($module) || $module == 'moodle' || $module == 'core') {
$module = 'error';
}
+ // Search for the $errorcode's associated string
+ // If not found, append the contents of $a to $debuginfo so helpful information isn't lost
if (function_exists('get_string_manager')) {
if (get_string_manager()->string_exists($errorcode, $module)) {
$message = get_string($errorcode, $module, $a);
@@ -505,9 +510,11 @@ function get_exception_info($ex) {
$message = get_string($errorcode, 'moodle', $a);
} else {
$message = $module . '/' . $errorcode;
+ $debuginfo .= PHP_EOL.'$a contents: '.print_r($a, true);
}
} else {
$message = $module . '/' . $errorcode;
+ $debuginfo .= PHP_EOL.'$a contents: '.print_r($a, true);
}
// Be careful, no guarantee weblib.php is loaded.
Please sign in to comment.
Something went wrong with that request. Please try again.