From 421acb439d3c3a09965da863cc9fbda3e09c3e75 Mon Sep 17 00:00:00 2001 From: pictuga Date: Sat, 21 Mar 2020 23:08:29 +0100 Subject: [PATCH] morss: make errors more readable over http --- morss/morss.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/morss/morss.py b/morss/morss.py index f34fec4..2005875 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -18,6 +18,7 @@ from . import readabilite import wsgiref.simple_server import wsgiref.handlers +import cgitb try: @@ -598,10 +599,10 @@ def cgi_wrapper(environ, start_response): except (KeyboardInterrupt, SystemExit): raise except Exception as e: - headers = {'status': '500 Oops', 'content-type': 'text/plain'} + headers = {'status': '500 Oops', 'content-type': 'text/html'} start_response(headers['status'], list(headers.items()), sys.exc_info()) - log('ERROR <%s>: %s' % (url, e.message), force=True) - return ['An error happened:\n%s' % e.message] + log('ERROR: %s' % repr(e), force=True) + return [cgitb.html(sys.exc_info())] def cli_app():