hgext/lfs/blobstore.py
changeset 40660 9f78d10742af
parent 40659 8863f08c1630
child 40661 380f5131ee7b
equal deleted inserted replaced
40659:8863f08c1630 40660:9f78d10742af
   269         batchreq.add_header('Content-Type', 'application/vnd.git-lfs+json')
   269         batchreq.add_header('Content-Type', 'application/vnd.git-lfs+json')
   270         try:
   270         try:
   271             rsp = self.urlopener.open(batchreq)
   271             rsp = self.urlopener.open(batchreq)
   272             rawjson = rsp.read()
   272             rawjson = rsp.read()
   273         except util.urlerr.httperror as ex:
   273         except util.urlerr.httperror as ex:
   274             raise LfsRemoteError(_('LFS HTTP error: %s') % ex,
   274             hints = {
   275                                  hint=_('api=%s, action=%s')
   275                 400: _('check that lfs serving is enabled on %s and "%s" is '
   276                                  % (url, action))
   276                        'supported') % (self.baseurl, action),
       
   277                 404: _('the "lfs.url" config may be used to override %s')
       
   278                        % self.baseurl,
       
   279             }
       
   280             hint = hints.get(ex.code, _('api=%s, action=%s') % (url, action))
       
   281             raise LfsRemoteError(_('LFS HTTP error: %s') % ex, hint=hint)
   277         try:
   282         try:
   278             response = json.loads(rawjson)
   283             response = json.loads(rawjson)
   279         except ValueError:
   284         except ValueError:
   280             raise LfsRemoteError(_('LFS server returns invalid JSON: %s')
   285             raise LfsRemoteError(_('LFS server returns invalid JSON: %s')
   281                                  % rawjson)
   286                                  % rawjson)