diff options
-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), |