aboutsummaryrefslogtreecommitdiff
path: root/qc_app/samples.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-02-09 04:22:51 +0300
committerFrederick Muriuki Muriithi2024-02-12 18:17:38 +0300
commit4c077c01db19e8adc01d9559677ad5693a1db909 (patch)
tree3aeedc2ef8b18aa5a6bddb162531487687ae11e9 /qc_app/samples.py
parentdd369b846524fed0c08d1b7318fd73478506c3ee (diff)
downloadgn-uploader-4c077c01db19e8adc01d9559677ad5693a1db909.tar.gz
Raise error if file is missing rather than returning a Union value.
Diffstat (limited to 'qc_app/samples.py')
-rw-r--r--qc_app/samples.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/qc_app/samples.py b/qc_app/samples.py
index 55e94ab..1845818 100644
--- a/qc_app/samples.py
+++ b/qc_app/samples.py
@@ -219,9 +219,12 @@ def upload_samples():
flash("Invalid grouping/population!", "alert-error")
return samples_uploads_page
- samples_file = save_file(request.files["samples_file"], Path(app.config["UPLOAD_FOLDER"]))
- if not bool(samples_file):
- flash("You need to provide a file with the samples data.")
+ try:
+ samples_file = save_file(request.files["samples_file"],
+ Path(app.config["UPLOAD_FOLDER"]))
+ except AssertionError:
+ flash("You need to provide a file with the samples data.",
+ "alert-error")
return samples_uploads_page
firstlineheading = (request.form.get("first_line_heading") == "on")