From 80fd4654a289a9b85b332bc519bbfc40d73998ee Mon Sep 17 00:00:00 2001 From: Antoine Goutenoir Date: Mon, 29 Mar 2021 20:50:04 +0200 Subject: [PATCH] feat: improve error reporting when not in production env --- flaskr/controllers/main_controller.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/flaskr/controllers/main_controller.py b/flaskr/controllers/main_controller.py index d1e2f7f..f856c5c 100644 --- a/flaskr/controllers/main_controller.py +++ b/flaskr/controllers/main_controller.py @@ -1,9 +1,9 @@ import csv import re -# from io import StringIO -from cStringIO import StringIO +# from cStringIO import StringIO from copy import deepcopy -from os import unlink +from io import StringIO +from os import unlink, getenv from os.path import join import geopy @@ -13,6 +13,7 @@ from flask import ( Blueprint, Response, render_template, + request, flash, redirect, url_for, @@ -699,7 +700,9 @@ def compute(): # process the queue of estimation requests except Exception as e: errmsg = u"Computation failed : %s" % (e,) - # errmsg = u"%s\n\n%s" % (errmsg, traceback.format_exc()) + if 'production' != getenv('FLASK_ENV', 'production'): + import traceback + errmsg = u"%s\n\n%s" % (errmsg, traceback.format_exc()) if estimation: _handle_failure(estimation, errmsg) return _respond(errmsg) -- libgit2 0.21.2