This is an automated email from the ASF dual-hosted git repository. dklco pushed a commit to branch SLING-8919-fix-error-dialog in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-app-cms.git
commit 078e3a68ce4c6ae8a9acac7a261e3327366d8c6c Author: Dan Klco <[email protected]> AuthorDate: Sat Dec 14 10:17:33 2019 -0500 Adding initial crack at fixing SLING-8919 --- ui/src/main/frontend/js/cms.js | 2 +- ui/src/main/frontend/js/editor.js | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/src/main/frontend/js/cms.js b/ui/src/main/frontend/js/cms.js index 6130912..1e88feb 100644 --- a/ui/src/main/frontend/js/cms.js +++ b/ui/src/main/frontend/js/cms.js @@ -71,7 +71,7 @@ window.top.location.reload(); }); } else { - Sling.CMS.ui.confirmMessage(msg, res.title, function () { + Sling.CMS.ui.confirmMessage(msg, res ? res.title : '', function () { Sling.CMS.ui.reloadContext(); }); } diff --git a/ui/src/main/frontend/js/editor.js b/ui/src/main/frontend/js/editor.js index d09eadb..bff4680 100644 --- a/ui/src/main/frontend/js/editor.js +++ b/ui/src/main/frontend/js/editor.js @@ -179,13 +179,15 @@ } }).then(function (response) { if (!response.ok) { - throw new Error(response.statusText); + throw new Error(response.json()); } return response.json(); }).catch(function (error) { - ui.confirmMessage(error.message, error.message, function () {}); + ui.confirmMessage('Failed to move', 'Failed to move: '+error, function () {}); }).then(function (res) { - ui.confirmReload(res, 'success'); + if(res){ + ui.confirmReload(res, 'success'); + } }); evt.target.classList.remove('sling-cms-droptarget__is-over'); }
