--- a/hgext/lfs/wireprotolfsserver.py Sat Apr 07 12:48:21 2018 -0400
+++ b/hgext/lfs/wireprotolfsserver.py Fri Apr 13 12:39:54 2018 -0400
@@ -10,6 +10,7 @@
import datetime
import errno
import json
+import traceback
from mercurial.hgweb import (
common as hgwebcommon,
@@ -63,6 +64,19 @@
res.headers[b'Content-Type'] = b'text/plain; charset=utf-8'
res.setbodybytes(b'')
+def _logexception(req):
+ """Write information about the current exception to wsgi.errors."""
+ tb = pycompat.sysbytes(traceback.format_exc())
+ errorlog = req.rawenv[r'wsgi.errors']
+
+ uri = b''
+ if req.apppath:
+ uri += req.apppath
+ uri += b'/' + req.dispatchpath
+
+ errorlog.write(b"Exception happened while processing request '%s':\n%s" %
+ (uri, tb))
+
def _processbatchrequest(repo, req, res):
"""Handle a request for the Batch API, which is the gateway to granting file
access.
@@ -179,6 +193,8 @@
verifies = store.verify(oid)
except IOError as inst:
if inst.errno != errno.ENOENT:
+ _logexception(req)
+
rsp['error'] = {
'code': 500,
'message': inst.strerror or 'Internal Server Server'