##// END OF EJS Templates
Handle exceptions in do_hgweb: Send "Internal Server Error", log traceback
Thomas Arendsen Hein -
r4015:769be3c5 default
parent child Browse files
Show More
@@ -8,7 +8,7 b''
8
8
9 from mercurial.demandload import demandload
9 from mercurial.demandload import demandload
10 import os, sys, errno
10 import os, sys, errno
11 demandload(globals(), "urllib BaseHTTPServer socket SocketServer")
11 demandload(globals(), "urllib BaseHTTPServer socket SocketServer traceback")
12 demandload(globals(), "mercurial:ui,hg,util,templater")
12 demandload(globals(), "mercurial:ui,hg,util,templater")
13 demandload(globals(), "hgweb_mod:hgweb hgwebdir_mod:hgwebdir request:wsgiapplication")
13 demandload(globals(), "hgweb_mod:hgweb hgwebdir_mod:hgwebdir request:wsgiapplication")
14 from mercurial.i18n import gettext as _
14 from mercurial.i18n import gettext as _
@@ -55,10 +55,17 b' class _hgwebhandler(object, BaseHTTPServ'
55
55
56 def do_POST(self):
56 def do_POST(self):
57 try:
57 try:
58 self.do_hgweb()
58 try:
59 except socket.error, inst:
59 self.do_hgweb()
60 if inst[0] != errno.EPIPE:
60 except socket.error, inst:
61 raise
61 if inst[0] != errno.EPIPE:
62 raise
63 except StandardError, inst:
64 self._start_response("500 Internal Server Error", [])
65 self._write("Internal Server Error")
66 tb = "".join(traceback.format_exception(*sys.exc_info()))
67 self.log_error("Exception happened during processing request '%s':\n%s",
68 self.path, tb)
62
69
63 def do_GET(self):
70 def do_GET(self):
64 self.do_POST()
71 self.do_POST()
General Comments 0
You need to be logged in to leave comments. Login now