diff hgext/lfs/blobstore.py @ 40659:8863f08c1630

lfs: provide more Batch API error info via a hint in the raised exception A coworker had a typo in `lfs.url`, forgot it was even set because usually the blob server is inferred, and then got a 404. It would have been easier to debug with the failing URL printed.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 15 Nov 2018 17:55:01 -0500
parents b63dee7bd0d9
children 9f78d10742af
line wrap: on
line diff
--- a/hgext/lfs/blobstore.py	Thu Nov 15 17:50:14 2018 -0500
+++ b/hgext/lfs/blobstore.py	Thu Nov 15 17:55:01 2018 -0500
@@ -263,16 +263,17 @@
             'objects': objects,
             'operation': action,
         })
-        batchreq = util.urlreq.request('%s/objects/batch' % self.baseurl,
-                                       data=requestdata)
+        url = '%s/objects/batch' % self.baseurl
+        batchreq = util.urlreq.request(url, data=requestdata)
         batchreq.add_header('Accept', 'application/vnd.git-lfs+json')
         batchreq.add_header('Content-Type', 'application/vnd.git-lfs+json')
         try:
             rsp = self.urlopener.open(batchreq)
             rawjson = rsp.read()
         except util.urlerr.httperror as ex:
-            raise LfsRemoteError(_('LFS HTTP error: %s (action=%s)')
-                                 % (ex, action))
+            raise LfsRemoteError(_('LFS HTTP error: %s') % ex,
+                                 hint=_('api=%s, action=%s')
+                                 % (url, action))
         try:
             response = json.loads(rawjson)
         except ValueError: