From 925b0bd02197f67fbf8c6f6eb990e11b2ff6c6ad Mon Sep 17 00:00:00 2001 From: Matt Westcott Date: Tue, 2 Jan 2018 23:57:47 +0000 Subject: [PATCH] Reinstate error reporting on image upload from #2167 --- CHANGELOG.txt | 3 ++- docs/releases/2.0.rst | 1 + wagtail/images/templates/wagtailimages/chooser/chooser.js | 8 ++++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 1ed1b905fd..b94f8768fd 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -67,7 +67,8 @@ Changelog * Fix: Style of the page unlock button was broken (Bertrand Bordage) * Fix: Admin search no longer floods browser history (Bertrand Bordage) * Fix: Version comparison now handles custom primary keys on inline models correctly (LB (Ben Johnston)) - * Fixed error when inserting chooser panels into FieldRowPanel (Florent Osmont, Bertrand Bordage) + * Fix: Fixed error when inserting chooser panels into FieldRowPanel (Florent Osmont, Bertrand Bordage) + * Fix: Reinstated missing error reporting on image upload (Matt Westcott) 1.13.1 (17.11.2017) diff --git a/docs/releases/2.0.rst b/docs/releases/2.0.rst index ff635497b4..67aeeda93a 100644 --- a/docs/releases/2.0.rst +++ b/docs/releases/2.0.rst @@ -96,6 +96,7 @@ Bug fixes * Admin search no longer floods browser history (Bertrand Bordage) * Version comparison now handles custom primary keys on inline models correctly (LB (Ben Johnston)) * Fixed error when inserting chooser panels into FieldRowPanel (Florent Osmont, Bertrand Bordage) + * Reinstated missing error reporting on image upload (Matt Westcott) Upgrade considerations diff --git a/wagtail/images/templates/wagtailimages/chooser/chooser.js b/wagtail/images/templates/wagtailimages/chooser/chooser.js index 6a43592052..7b7000464b 100644 --- a/wagtail/images/templates/wagtailimages/chooser/chooser.js +++ b/wagtail/images/templates/wagtailimages/chooser/chooser.js @@ -76,6 +76,14 @@ function(modal) { dataType: 'text', success: function(response){ modal.loadResponseText(response); + }, + error: function(response, textStatus, errorThrown) { + {% trans "Server Error" as error_label %} + {% trans "Report this error to your webmaster with the following information:" as error_message %} + message = '{{ error_message|escapejs }}
' + errorThrown + ' - ' + response.status; + $('#upload').append( + '
' + + '{{ error_label|escapejs }}: ' + message + '
'); } }); }