summaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorMandragorat Wandystanu <wktir@wandystan.eu>2017-11-16 15:31:15 +0100
committerMandragorat Wandystanu <wktir@wandystan.eu>2017-11-16 15:31:15 +0100
commit1fd549c9c4c00d34a132b5d8746064245d4c3772 (patch)
tree68df86c6b304f110fe9eb6981060298e1bc821c0 /static
parent9d6341d270c01d09194a1bf169390ad8198f694d (diff)
static/js/app.js: Display error description returned by upload.php even if it returns status code other than 200 OK.
Diffstat (limited to 'static')
-rw-r--r--static/js/app.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/static/js/app.js b/static/js/app.js
index 3cdc6d7..8f4146f 100644
--- a/static/js/app.js
+++ b/static/js/app.js
@@ -94,8 +94,8 @@ document.addEventListener('DOMContentLoaded', function() {
row.appendChild(url);
var link = document.createElement('a');
+ var response = JSON.parse(xhr.responseText);
if (respStatus === 200) {
- var response = JSON.parse(xhr.responseText);
if (response.success) {
link.textContent = response.files[0].url.replace(/.*?:\/\//g, '');
link.href = response.files[0].url;
@@ -131,7 +131,12 @@ document.addEventListener('DOMContentLoaded', function() {
link.textContent = 'File too big!';
url.appendChild(link);
} else {
- link.textContent = 'Server error!';
+ try {
+ var response = JSON.parse(xhr.responseText);
+ link.textContent = 'Error: ' + response.description;
+ } catch (e) {
+ link.textContent = 'Server error!';
+ }
url.appendChild(link);
}
}