diff options
Diffstat (limited to 'static/js/app.js')
| -rw-r--r-- | static/js/app.js | 9 |
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); } } |
