MDL-55767 competencies: Better exceptions for persistent
The persistent exceptions "squash" all the details and only display them to developers. This leads to generic "Invalid persistent" messages with no explanation. Instead lets include the message detail always.
This commit is contained in:
@@ -36,11 +36,13 @@ defined('MOODLE_INTERNAL') || die();
|
||||
class invalid_persistent_exception extends \moodle_exception {
|
||||
|
||||
public function __construct(array $errors = array()) {
|
||||
$forhumans = array();
|
||||
$debuginfo = array();
|
||||
foreach ($errors as $key => $message) {
|
||||
$debuginfo[] = "$key: $message";
|
||||
$forhumans[] = $message;
|
||||
}
|
||||
parent::__construct('invalidpersistent', 'core_competency', null, null, implode(' - ', $debuginfo));
|
||||
parent::__construct('invalidpersistent', 'core_competency', null, implode(', ', $forhumans), implode(' - ', $debuginfo));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user