Show More
@@ -10,6 +10,7 b' from __future__ import absolute_import' | |||
|
10 | 10 | import datetime |
|
11 | 11 | import errno |
|
12 | 12 | import json |
|
13 | import traceback | |
|
13 | 14 | |
|
14 | 15 | from mercurial.hgweb import ( |
|
15 | 16 | common as hgwebcommon, |
@@ -63,6 +64,19 b' def _sethttperror(res, code, message=Non' | |||
|
63 | 64 | res.headers[b'Content-Type'] = b'text/plain; charset=utf-8' |
|
64 | 65 | res.setbodybytes(b'') |
|
65 | 66 | |
|
67 | def _logexception(req): | |
|
68 | """Write information about the current exception to wsgi.errors.""" | |
|
69 | tb = pycompat.sysbytes(traceback.format_exc()) | |
|
70 | errorlog = req.rawenv[r'wsgi.errors'] | |
|
71 | ||
|
72 | uri = b'' | |
|
73 | if req.apppath: | |
|
74 | uri += req.apppath | |
|
75 | uri += b'/' + req.dispatchpath | |
|
76 | ||
|
77 | errorlog.write(b"Exception happened while processing request '%s':\n%s" % | |
|
78 | (uri, tb)) | |
|
79 | ||
|
66 | 80 | def _processbatchrequest(repo, req, res): |
|
67 | 81 | """Handle a request for the Batch API, which is the gateway to granting file |
|
68 | 82 | access. |
@@ -179,6 +193,8 b' def _batchresponseobjects(req, objects, ' | |||
|
179 | 193 | verifies = store.verify(oid) |
|
180 | 194 | except IOError as inst: |
|
181 | 195 | if inst.errno != errno.ENOENT: |
|
196 | _logexception(req) | |
|
197 | ||
|
182 | 198 | rsp['error'] = { |
|
183 | 199 | 'code': 500, |
|
184 | 200 | 'message': inst.strerror or 'Internal Server Server' |
@@ -289,6 +289,18 b' Test a checksum failure during the proce' | |||
|
289 | 289 | $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 500 - (glob) |
|
290 | 290 | |
|
291 | 291 | $ grep -v ' File "' $TESTTMP/errors.log |
|
292 | $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.git/info/lfs/objects/batch': (glob) | |
|
293 | $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob) | |
|
294 | $LOCALIP - - [$ERRDATE$] HG error: verifies = store.verify(oid) (glob) | |
|
295 | $LOCALIP - - [$ERRDATE$] HG error: raise IOError(errno.EIO, '%s: I/O error' % oid) (glob) | |
|
296 | $LOCALIP - - [$ERRDATE$] HG error: IOError: [Errno 5] f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e: I/O error (glob) | |
|
297 | $LOCALIP - - [$ERRDATE$] HG error: (glob) | |
|
298 | $LOCALIP - - [$ERRDATE$] HG error: Exception happened while processing request '/.git/info/lfs/objects/batch': (glob) | |
|
299 | $LOCALIP - - [$ERRDATE$] HG error: Traceback (most recent call last): (glob) | |
|
300 | $LOCALIP - - [$ERRDATE$] HG error: verifies = store.verify(oid) (glob) | |
|
301 | $LOCALIP - - [$ERRDATE$] HG error: raise IOError(errno.EIO, '%s: I/O error' % oid) (glob) | |
|
302 | $LOCALIP - - [$ERRDATE$] HG error: IOError: [Errno 5] b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c: I/O error (glob) | |
|
303 | $LOCALIP - - [$ERRDATE$] HG error: (glob) | |
|
292 | 304 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c': (glob) |
|
293 | 305 | Traceback (most recent call last): |
|
294 | 306 | self.do_write() |
General Comments 0
You need to be logged in to leave comments.
Login now