diff options
author | Frederick Muriuki Muriithi | 2024-02-09 04:22:51 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-02-12 18:17:38 +0300 |
commit | 4c077c01db19e8adc01d9559677ad5693a1db909 (patch) | |
tree | 3aeedc2ef8b18aa5a6bddb162531487687ae11e9 /qc_app/samples.py | |
parent | dd369b846524fed0c08d1b7318fd73478506c3ee (diff) | |
download | gn-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.py | 9 |
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") |