Mercurial > hg
diff hgext/largefiles/remotestore.py @ 15253:67d010779907
largefiles: improve error reporting
- tweak wording of some error messages
- use consistent capitalization
- always say 'largefile', not 'lfile'
- fix I18N problems
- only raise Abort for errors the user can do something about
author | Greg Ward <greg@gerg.ca> |
---|---|
date | Thu, 13 Oct 2011 20:24:29 -0400 |
parents | 6e809bb4f969 |
children | 9e1616307c4c |
line wrap: on
line diff
--- a/hgext/largefiles/remotestore.py Wed Oct 12 20:59:27 2011 -0400 +++ b/hgext/largefiles/remotestore.py Thu Oct 13 20:24:29 2011 -0400 @@ -50,9 +50,10 @@ def _getfile(self, tmpfile, filename, hash): # quit if the largefile isn't there stat = self._stat(hash) - if stat: - raise util.Abort(_('remotestore: largefile %s is %s') % - (hash, stat == 1 and 'invalid' or 'missing')) + if stat == 1: + raise util.Abort(_('remotestore: largefile %s is invalid') % hash) + elif stat == 2: + raise util.Abort(_('remotestore: largefile %s is missing') % hash) try: length, infile = self._get(hash) @@ -64,7 +65,7 @@ # This usually indicates a connection problem, so don't # keep trying with the other files... they will probably # all fail too. - raise util.Abort('%s: %s' % (self.url, str(e.reason))) + raise util.Abort('%s: %s' % (self.url, e.reason)) except IOError, e: raise basestore.StoreError(filename, hash, self.url, str(e)) @@ -101,5 +102,5 @@ % (cset, filename)) return True # failed else: - raise util.Abort(_('check failed, unexpected response' - 'statlfile: %d') % stat) + raise RuntimeError('verify failed: unexpected response from ' + 'statlfile (%r)' % stat)