diff --git a/lib/form/filemanager.js b/lib/form/filemanager.js index 5711dfe57b047..8f036d97540de 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);