Skip to content

Commit

Permalink
better traceback error
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin committed Sep 28, 2023
1 parent ffbe4bb commit d4fb144
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
9 changes: 8 additions & 1 deletion app/errors/handlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from app import db
from app.errors import bp
from flask import render_template
import traceback


@bp.app_errorhandler(404)
Expand All @@ -27,7 +28,13 @@ def internal_error(error):
str: HTML page for error 500.
"""
db.session.rollback()
return render_template("500.html"), 500
# Capture the exception details
traceback_info = traceback.format_exc()

return (
render_template("500.html", traceback_info=traceback_info),
500,
)


@bp.app_errorhandler(413)
Expand Down
8 changes: 5 additions & 3 deletions app/errors/templates/500.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{% extends "base.html" %} {% block content %}
<h1>Error 500: An unexpected error has occurred</h1>
<h3>Please try going to the Standard Vocabulary module and
press "Save tree" to re-generate files and use this function again !</h3>
<p>If this happened in the visualisation module, a common fix could be going to the Standard Vocabulary module and
press "Save tree" to re-generate files !</p>
<p>The administrator has been notified. Sorry for the inconvenience!</p>
<p>
Please press the back button to go to the index:
<a href="{{ url_for('index.index') }}">Back</a>
</p>
{% endblock %}
<h3> Traceback: </h5>
<pre>{{ traceback_info }}</pre>
{% endblock %}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "impatient"
version = "1.6.0"
version = "1.6.1"
description = "IMPatienT: an integrated web application to digitize, process and explore multimodal patient data"
authors = ["Corentin Meyer <co.meyer@unistra.fr>"]
license = "AGPL"
Expand Down

0 comments on commit d4fb144

Please sign in to comment.