-
Bug
-
Resolution: Fixed
-
Major
-
2.8.7, 2.9.1
-
MOODLE_28_STABLE, MOODLE_29_STABLE
-
MOODLE_28_STABLE, MOODLE_29_STABLE
-
MDL-51109-master -
When a scheduled task fails with some sort of database issue (see MDLSITE-4145 for one example where an index is being violated, you could write a basic bit of code to demonstrate it, but haven't got time right now), the exception handler traps the error but prevents an useful output - even in DEBUG_DEVELOPER mode.
To find what was going wrong I had to do:
diff --git a/admin/tool/task/cli/schedule_task.php b/admin/tool/task/cli/schedule_task.php
|
index 6904d48..f5700a6 100644
|
--- a/admin/tool/task/cli/schedule_task.php
|
+++ b/admin/tool/task/cli/schedule_task.php
|
@@ -148,7 +148,7 @@ if ($execute = $options['execute']) {
|
}
|
mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
|
mtrace("... used " . (microtime(true) - $pretime) . " seconds");
|
- mtrace("Task failed: " . $e->getMessage());
|
+ mtrace("Task failed: " . $e->getMessage().$e->debuginfo);
|
\core\task\manager::scheduled_task_failed($task);
|
get_mailer('close');
|
exit(1);
|
There should be a way to see that error without having to hack code. We could do it only in the cli runner, or when debug mode is set, etc.
- Discovered while testing
-
MDLSITE-4145 Learn.moodle is trying to re-award a previously awarded badge
- Resolved