From 672303820904e86da7c777542248955481a9cf56 Mon Sep 17 00:00:00 2001 From: Ferry Boender Date: Wed, 17 Jun 2015 08:12:55 +0200 Subject: [PATCH] Show error code and text in browser. --- src/webapp.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/webapp.py b/src/webapp.py index f8a929e..4ad2b1c 100644 --- a/src/webapp.py +++ b/src/webapp.py @@ -207,12 +207,17 @@ class WebAppHandler(BaseHTTPRequestHandler): raise HTTPError(404, "Not found") method_cb(**params) except HTTPError, e: + # HTTP erors are generally thrown by the webapp on purpose. Send + # error to the browser. if e.status_code not in (401, ): self.scriptform.log.exception(e) self.send_response(e.status_code) for header_k, header_v in e.headers.items(): self.send_header(header_k, header_v) self.end_headers() + self.wfile.write("Error {}: {}".format(e.status_code, + e.msg)) + self.wfile.flush() return False except Exception, e: self.scriptform.log.exception(e)