Skip to content

Commit d4fb144

Browse files
author
Corentin
committed
better traceback error
1 parent ffbe4bb commit d4fb144

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

app/errors/handlers.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from app import db
22
from app.errors import bp
33
from flask import render_template
4+
import traceback
45

56

67
@bp.app_errorhandler(404)
@@ -27,7 +28,13 @@ def internal_error(error):
2728
str: HTML page for error 500.
2829
"""
2930
db.session.rollback()
30-
return render_template("500.html"), 500
31+
# Capture the exception details
32+
traceback_info = traceback.format_exc()
33+
34+
return (
35+
render_template("500.html", traceback_info=traceback_info),
36+
500,
37+
)
3138

3239

3340
@bp.app_errorhandler(413)

app/errors/templates/500.html

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
{% extends "base.html" %} {% block content %}
22
<h1>Error 500: An unexpected error has occurred</h1>
3-
<h3>Please try going to the Standard Vocabulary module and
4-
press "Save tree" to re-generate files and use this function again !</h3>
3+
<p>If this happened in the visualisation module, a common fix could be going to the Standard Vocabulary module and
4+
press "Save tree" to re-generate files !</p>
55
<p>The administrator has been notified. Sorry for the inconvenience!</p>
66
<p>
77
Please press the back button to go to the index:
88
<a href="{{ url_for('index.index') }}">Back</a>
99
</p>
10-
{% endblock %}
10+
<h3> Traceback: </h5>
11+
<pre>{{ traceback_info }}</pre>
12+
{% endblock %}

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "impatient"
3-
version = "1.6.0"
3+
version = "1.6.1"
44
description = "IMPatienT: an integrated web application to digitize, process and explore multimodal patient data"
55
authors = ["Corentin Meyer <[email protected]>"]
66
license = "AGPL"

0 commit comments

Comments
 (0)