From a68fe177ae41f2e58a64b3f8dcf3f825d004eeca Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 1 Jul 2024 14:59:32 -0500 Subject: Respond with JSON. Handle error messages on UI. --- qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'qc_app/templates') diff --git a/qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html b/qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html index c6c79e5..07c240f 100644 --- a/qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html +++ b/qc_app/templates/rqtl2/upload-rqtl2-bundle-step-01.html @@ -240,6 +240,21 @@ window.location.replace(uri); } }); + + r.on("error", (message, file) => { + filename = (file.webkitRelativePath + || file.relativePath + || file.fileName + || file.name); + jsonmsg = JSON.parse(message); + alert("There was an error while uploading your file '" + + filename + + "'. The error message was:\n\n\t" + + jsonmsg.error + + " (" + + jsonmsg.statuscode + + "): " + jsonmsg.message); + }) } else { setup_upload_handlers( "frm-upload-rqtl2-bundle", make_data_uploader( -- cgit v1.2.3