From 0b47330c16ea4e95afae9842070559f41f76c3da Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 4 Mar 2024 11:14:56 +0300 Subject: Check for exception args and provide traceback. --- gn3/errors.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gn3/errors.py') diff --git a/gn3/errors.py b/gn3/errors.py index 7a9d0be..1833bf6 100644 --- a/gn3/errors.py +++ b/gn3/errors.py @@ -98,7 +98,9 @@ def handle_generic(exc: Exception) -> Response: current_app.logger.error(exc) resp = jsonify({ "error": type(exc).__name__, - "error_description": exc.args[0], + "error_description": ( + exc.args[0] if bool(exc.args) else "Generic Exception"), + "trace": traceback.format_exc() }) resp.status_code = 500 return resp -- cgit v1.2.3