Skip to content

Commit

Permalink
fix: add missing ValueError handling
Browse files Browse the repository at this point in the history
  • Loading branch information
cquintana92 committed Nov 18, 2024
1 parent 7172325 commit 92eba9e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/dashboard/views/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ def setting():
flash("Your preference has been updated", "success")
return redirect(url_for("dashboard.setting"))
elif request.form.get("form-name") == "random-alias-suffix":
scheme = int(request.form.get("random-alias-suffix-generator"))
try:
scheme = int(request.form.get("random-alias-suffix-generator"))
except ValueError:
flash("Invalid value", "error")
return redirect(url_for("dashboard.setting"))

if AliasSuffixEnum.has_value(scheme):
current_user.random_alias_suffix = scheme
Session.commit()
Expand Down

0 comments on commit 92eba9e

Please sign in to comment.