Commit 3f80a2c7 authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Gerrit Code Review

Merge "Bug 1855771: Allow generic system errors to give more detail"

parents 27b6c8fe 9b35263d
......@@ -81,6 +81,7 @@ $string['invaliddirection'] = 'Invalid direction %s.';
$string['onlyoneprofileviewallowed'] = 'You are only allowed one profile page.';
$string['cannotputblocktypeintoview'] = 'Cannot put %s block types into this page';
$string['onlyoneblocktypeperview'] = 'Cannot put more than one %s block type into a page.';
$string['errorat'] = ' at ';
// if you change these next two , be sure to change them in libroot/errors.php
// as they are duplicated there, in the case that get_string was not available.
......
......@@ -533,14 +533,14 @@ function error ($code, $message, $file, $line, $vars) {
function exception ($e) {
$classname = get_class($e);
if (!($e instanceof MaharaException)) {
$e = new SystemException("[{$classname}]: " . $e->getMessage(), $e->getCode());
$e = new SystemException("[{$classname}]: " . $e->getMessage() . get_string('errorat', 'error') . $e->getFile() . ':' . $e->getLine(), $e->getCode());
}
else if ($classname == 'MaharaException') {
// Mahara coding practice says not to use MaharaException directly, but for more
// graceful error handling we have chosen not to make it abstract. Instead, make
// it print like a SystemException.
/* @var MaharaException $e */
$e = new SystemException($e->getMessage(), $e->getCode());
$e = new SystemException($e->getMessage() . get_string('errorat', 'error') . $e->getFile() . ':' . $e->getLine(), $e->getCode());
}
// Display the message and die
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment