diff options
author | Frederick Muriuki Muriithi | 2024-04-05 13:51:29 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-04-05 13:51:29 +0300 |
commit | 6c308016bf354c6f6e6dddc6d580e524fce2b91e (patch) | |
tree | b2bc912e56b07414ca371d86149d07180f996f76 /qc_app/upload | |
parent | 6c172fbaedcc40093db9874c067dd079678e4205 (diff) | |
download | gn-uploader-6c308016bf354c6f6e6dddc6d580e524fce2b91e.tar.gz |
Handle exceptions creating ProbeSet datasets.
Diffstat (limited to 'qc_app/upload')
-rw-r--r-- | qc_app/upload/rqtl2.py | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/qc_app/upload/rqtl2.py b/qc_app/upload/rqtl2.py index 7a53756..60aeba7 100644 --- a/qc_app/upload/rqtl2.py +++ b/qc_app/upload/rqtl2.py @@ -656,14 +656,27 @@ def create_probeset_dataset(species_id: int, population_id: int):#pylint: disabl flash("Invalid averaging method provided!", "alert-error error-rqtl2") return summary_page - dset = probeset_create_dataset(conn, - int(form["probe-study-id"]), - int(form["averageid"]), - form["datasetname"], - form["datasetfullname"], - form["datasetshortname"], - form["datasetpublic"] == "on", - form.get("datasetdatascale", "log2")) + try: + dset = probeset_create_dataset(conn, + int(form["probe-study-id"]), + int(form["averageid"]), + form["datasetname"], + form["datasetfullname"], + form["datasetshortname"], + form["datasetpublic"] == "on", + form.get( + "datasetdatascale", "log2")) + except mdb.IntegrityError as _ierr: + flash(("A dataset with that name already exists. Try selecting " + "from list of datasets instead."), + "alert-error error-rqtl2") + return summary_page + except Exception as _exc: + app.logger.debug("Error creating ProbeSet dataset: %s", + traceback.format_exc()) + flash(("There was a problem creating your dataset. Please try " + "again."), + "alert-error error-rqtl2") return render_template( "rqtl2/create-probe-dataset-success.html", species=species_by_id(conn, species_id), |