Currently, they support throwing exceptions if unit tests are running. It would be great for any code to be able to say, "I want exceptions thrown" instead, either by defining a constant or setting something temporarily in $CFG, eg:
1.
define('CONVERTERRORSTOEXCEPTIONS', 1);
// whatever code that might call error or print_error
2.
$CFG->converterrorstoexceptions = true;
// whatever code that might call error or print_error
$CFG->converterrorstoexcetions = false;
3.
$tmpsetting = $CFG->converterrorstoexceptions;
$CFG->converterrorstoexceptions = true;
// whatever code that might call error or print_error
$CFG->converterrorstoexceptions = $tmpsetting;
I prefer 3.
- has been marked as being related by
-
MDL-16277 mnet dispatcher needs to not GUESS about functions/methods/static etc
-
- Closed
-