From ec6314fed8ec4807c369324b5f22c8f8fd39abea Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Thu, 13 Mar 2025 08:10:06 +0500 Subject: [PATCH] show server error instead of fronend parsing error --- .../competitions/detail/submission_upload.tag | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/src/static/riot/competitions/detail/submission_upload.tag b/src/static/riot/competitions/detail/submission_upload.tag index 7df267a2b..0a56ca02f 100644 --- a/src/static/riot/competitions/detail/submission_upload.tag +++ b/src/static/riot/competitions/detail/submission_upload.tag @@ -477,23 +477,12 @@ if (response) { try { let errors = JSON.parse(response.responseText) - - // Clean up errors to not be arrays but plain text - Object.keys(errors).map(function (key, index) { - errors[key] = errors[key].join('; ') - }) - - // Create a string to concatenate all error messages - let errorMessages = "Error in submission upload:\n" - Object.keys(errors).forEach(function (key) { - errorMessages += key + ": " + errors[key] + "\n" - }) - - toastr.error(errorMessages) + let error_str = Object.keys(errors).map(function (key) { return errors[key] }).join("; ") + toastr.error("Submission upload failed: " + error_str) self.update({errors: errors}) } catch (e) { - toastr.error("Error in submission upload\n"+e) + toastr.error("Submission upload failed. Server returned: " + response.status + " " + response.statusText); } } else { toastr.error("Something went wrong, please try again later")