diff --git a/js/owrap.oJob.js b/js/owrap.oJob.js index 4d9fe653..93d2e01c 100755 --- a/js/owrap.oJob.js +++ b/js/owrap.oJob.js @@ -900,7 +900,11 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) { var _r = $rest({ throwExceptions: true }).getBytes(url); _r = String(Packages.openaf.AFCmdBase.afc.dbIP(_r)); if (isString(_r)) { - _r = af.fromYAML(_r, true); + try { + _r = af.fromYAML(_r, true); + } catch (e) { + throw "Failed to parse encrypted YAML from URL '" + url + "'. The content may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message; + } } if (isMap(_r) && __JSONformat.unsafe) { traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); }); @@ -918,7 +922,11 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) { var _r = $rest({ throwExceptions: true }).getBytes(url); _r = String(Packages.openaf.AFCmdBase.afc.dbIP(_r)); if (isString(_r)) { - try { _r = JSON.parse(_r); } catch (e) { } + try { + _r = JSON.parse(_r); + } catch (e) { + throw "Failed to parse encrypted JSON from URL '" + url + "'. The content may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message; + } } if (isMap(_r) && __JSONformat.unsafe) { traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); }); @@ -929,7 +937,12 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) { var fnReadEncYAML = f => { var content = io.readFileBytes(f); content = String(Packages.openaf.AFCmdBase.afc.dbIP(content)); - var _r = af.fromYAML(content, true); + var _r; + try { + _r = af.fromYAML(content, true); + } catch (e) { + throw "Failed to parse encrypted YAML file '" + f + "'. The file may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message; + } if (isMap(_r) && __JSONformat.unsafe) { traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); }); } @@ -938,7 +951,12 @@ OpenWrap.oJob.prototype.__loadFile = function(aFile, removeTodos, isInclude) { var fnReadEncJSON = f => { var content = io.readFileBytes(f); content = String(Packages.openaf.AFCmdBase.afc.dbIP(content)); - var _r = JSON.parse(content); + var _r; + try { + _r = JSON.parse(content); + } catch (e) { + throw "Failed to parse encrypted JSON file '" + f + "'. The file may not be properly encrypted or the decryption key may be incorrect. Error: " + e.message; + } if (isMap(_r) && __JSONformat.unsafe) { traverse(_r, (aK, aV, aP, aO) => { if (isString(aV) && aV.startsWith("!!js/eval ")) aO[aK] = eval(aV.slice(10)); }); }