From 928552525647422597780cad8b6ead6088555e01 Mon Sep 17 00:00:00 2001 From: pictuga Date: Mon, 16 Jun 2014 13:55:59 +0200 Subject: [PATCH] Unify internal/external errors --- morss/morss.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/morss/morss.py b/morss/morss.py index 852cac5..fe5b25c 100644 --- a/morss/morss.py +++ b/morss/morss.py @@ -760,18 +760,13 @@ def cgi_wrapper(environ, start_response): return cgi_app(environ, start_response) or [] except (KeyboardInterrupt, SystemExit): raise - except MorssException as e: - headers = {} - headers['status'] = '500 Oops' - headers['content-type'] = 'text/plain' - start_response(headers['status'], headers.items(), sys.exc_info()) - return 'Internal Error: %s' % e.message except Exception as e: headers = {} headers['status'] = '500 Oops' headers['content-type'] = 'text/plain' start_response(headers['status'], headers.items(), sys.exc_info()) - return 'Unknown Error: %s' % e.message + log('ERROR: %s' % e.message, force=True) + return 'An error happened' def cli_app(): options = Options(sys.argv[1:-1]) @@ -829,10 +824,8 @@ def main(): cli_app() except (KeyboardInterrupt, SystemExit): raise - except MorssException as e: - print 'Internal Error: %s' % e.message except Exception as e: - print 'Unknown Error: %s' % e.message + print 'ERROR: %s' % e.message if __name__ == '__main__': main()