Created
February 7, 2013 09:48
-
-
Save mudrd8mz/4729921 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/setuplib.php b/lib/setuplib.php | |
index 88fd5fd..d3b8a7e 100644 | |
--- a/lib/setuplib.php | |
+++ b/lib/setuplib.php | |
@@ -137,14 +137,23 @@ class moodle_exception extends Exception { | |
if (get_string_manager()->string_exists($errorcode, $module)) { | |
$message = get_string($errorcode, $module, $a); | |
+ $haserrorstring = true; | |
} else { | |
$message = $module . '/' . $errorcode; | |
+ $haserrorstring = false; | |
} | |
if (defined('PHPUNIT_TEST') and PHPUNIT_TEST and $debuginfo) { | |
$message = "$message ($debuginfo)"; | |
} | |
+ if (!$haserrorstring and defined('PHPUNIT_TEST') and PHPUNIT_TEST) { | |
+ // Append the contents of $a to $debuginfo so helpful information isn't lost. | |
+ // This emulates what {@link get_exception_info()} does. Unfortunately that | |
+ // function is not used by phpunit. | |
+ $message .= PHP_EOL.'$a contents: '.print_r($a, true); | |
+ } | |
+ | |
parent::__construct($message, 0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment