Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding in better exception catching for webapp #231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions uaaextras/webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,8 @@ def signup():
return redirect(url_for("logout"))
else:
logging.exception("An error occured communicating with UAA")
except Exception:
logging.exception("An error occured during the invite process")
except Exception as e:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon further review, I think these changes are unnecessary because logging.exception prints a stack trace with the error already?

https://stackoverflow.com/a/5191885

logging.exception("An error occured during the invite process. Reason: " + e)

return render_template("error/internal.html"), 500

Expand Down Expand Up @@ -566,8 +566,8 @@ def invite():
return redirect(url_for("logout"))
else:
logging.exception("An error occured communicating with UAA")
except Exception:
logging.exception("An error occured during the invite process")
except Exception as e:
logging.exception("An error occured during the invite process. Reason: " + e)

return render_template("error/internal.html"), 500

Expand Down Expand Up @@ -687,8 +687,8 @@ def change_password():
for error in str(exc).split(","):
flash(error)
return render_template("change_password.html")
except Exception:
logging.exception("Error changing password")
except Exception as e:
logging.exception("Error changing password. Reason: " + e)

return render_template("error/internal.html"), 500

Expand Down Expand Up @@ -838,8 +838,8 @@ def reset_password():
"Unable to set temporary password. Did you use the right email address?"
)
return render_template("reset_password.html")
except Exception:
logging.exception("Unable to set your temporary password.")
except Exception as e:
logging.exception("Unable to set your temporary password. Reason: " + e)

@app.route("/reset-totp", methods=["GET", "POST"])
def reset_totp():
Expand Down