remove copied user db integrity error

This commit is contained in:
crunk 2024-05-28 23:35:40 +02:00
parent 659acc902e
commit b71a694777

View File

@ -94,14 +94,10 @@ def save_described_file_to_db(describe_form, distribusi_file):
distribusi_file.tags = describe_form.searchtags distribusi_file.tags = describe_form.searchtags
db.session.add(distribusi_file) db.session.add(distribusi_file)
db.session.commit() db.session.commit()
except InvalidRequestError: except (InvalidRequestError, IntegrityError):
db.session.rollback() db.session.rollback()
describe_form.save.errors.append("Something went wrong!") describe_form.save.errors.append("Something went wrong!")
flash("Something went wrong!", "danger") flash("Something went wrong!", "danger")
except IntegrityError:
db.session.rollback()
describe_form.save.errors.append("User already exists!")
flash("User already exists!", "warning")
except DataError: except DataError:
db.session.rollback() db.session.rollback()
describe_form.save.errors.append("Invalid Entry") describe_form.save.errors.append("Invalid Entry")