From 09aacafb9e31831c2f702e5079b0cf595d737338 Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Fri, 8 Nov 2024 16:18:21 +0000 Subject: [PATCH] MDL-83653 file manager: report ajax errors This is for things like when you click on a file, and then click on the delete button, and an error happens then. Previously that was ignored. --- lib/form/filemanager.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index 5711dfe57b0..fe230d6e791 100644 --- a/lib/form/filemanager.js +++ b/lib/form/filemanager.js @@ -177,6 +177,12 @@ M.form_filemanager.init = function(Y, options) { var data = null; try { data = Y.JSON.parse(o.responseText); + if (data.error) { + Y.use('moodle-core-notification-ajaxexception', function() { + return new M.core.ajaxException(data); + }); + return; + } } catch(e) { scope.print_msg(M.util.get_string('invalidjson', 'repository'), 'error'); Y.error(M.util.get_string('invalidjson', 'repository')+":\n"+o.responseText);