Moodle UI isn't loading when exceptions are thrown

Moodle UI isn't loading when exceptions are thrown

by Semyon Lavrentev -
Number of replies: 3
Hello! Recently I've been working with old plugin named mod_tracker. Whenever I get some error thrown in this module, UI seems to not load properly, I guess the cause of this is M and Y modules not being defined.

This problem sometimes appeared on other pages, like quiz module, but that was a rare occasion when we broke the coderunner question type. Never seen anything like this in other circumstances.

I've read that turning on zlib compression helps, but it feels like a cheap workaround, rather than a solution. Any ideas on what can possibly be wrong in this case and how to fix it?


Average of ratings: -
In reply to Semyon Lavrentev

Re: Moodle UI isn't loading when exceptions are thrown

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Hi Semyon,
Which version of mod_tracker are you using?

I use it too and the version in Moodle downloads is out of date. To get a more up-to-date version and the also needed, local/vflibs, you need to go to the, Source control URL, at the github repository: https://github.com/vfremaux/moodle-mod_tracker and pick the most recent branch.

Look through the other repos to find the most current vflibs to go with it.

I am currently using:
$plugin->release = '3.9.0 (Build 2020120500)';
$plugin->dependencies = array('local_vflibs' => 2016081100);

This is on a Moodle 4.1.3+ site and I did do a couple of modifications to get rid of a couple of debug messages.
In reply to AL Rachels

Re: Moodle UI isn't loading when exceptions are thrown

by Semyon Lavrentev -
Hi AL,
I am in touch with Git URL for this plugin, I tried using 3.8 STABLE on Moodle 3.8.9 and currently using 4.0 WORKING version of tracker with Moodle 4.0.2, with a lot of fixes though, but anyway both the STABLE and BETA versions all have the same render problems on thrown errors.

And by the way I commented out local_vflibs dependency from this plugin, because it's quite a big library, but tracker only uses jquery plot lib from it, and we currently don't need plot reports. I'm not sure that lack of local_vflibs plugin is causing this issue, but I will check that and come back with the answers later.

I might've found the issue, if I try to throw an error directly on "view.php" page, UI, CSS and other stuff is loaded properly, until I try to throw errors after this line of code: "$output = $OUTPUT->header();"
As far as I know, this output is usually echoed immediately in other plugins, and I guess those headers can be lost in output if some unexpected error occurs before $output variable is echoed. I will research this after weekend and get back to this post with results.
In reply to Semyon Lavrentev

Re: Moodle UI isn't loading when exceptions are thrown

by Semyon Lavrentev -
The problem really was that sometimes $output never got echoed because of thrown errors, I just switched "$output .=" parts to "echo" and everything seems to work fine.