Mercurial > hg
comparison mercurial/statichttprepo.py @ 41406:2bf689b13a17
statichttprepo: use URLError.reason directly
0b3f4be5c5bf changed str(inst) to inst.reason[0] all the way back
in 2006. URLError.reason is a str and we should have taken that
attribute in its entirety. I think the code was supposed to be
inst.args[1] for compatibility with ancient Python versions.
Python 2.7 always sets .reason, so it should be safe to use
directly.
Differential Revision: https://phab.mercurial-scm.org/D5715
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 26 Jan 2019 10:53:10 -0800 |
parents | 3913223417ea |
children | 6e9bebb65ce7 |
comparison
equal
deleted
inserted
replaced
41405:9b3be572ff0c | 41406:2bf689b13a17 |
---|---|
57 code = f.code | 57 code = f.code |
58 except urlerr.httperror as inst: | 58 except urlerr.httperror as inst: |
59 num = inst.code == 404 and errno.ENOENT or None | 59 num = inst.code == 404 and errno.ENOENT or None |
60 raise IOError(num, inst) | 60 raise IOError(num, inst) |
61 except urlerr.urlerror as inst: | 61 except urlerr.urlerror as inst: |
62 raise IOError(None, inst.reason[1]) | 62 raise IOError(None, inst.reason) |
63 | 63 |
64 if code == 200: | 64 if code == 200: |
65 # HTTPRangeHandler does nothing if remote does not support | 65 # HTTPRangeHandler does nothing if remote does not support |
66 # Range headers and returns the full entity. Let's slice it. | 66 # Range headers and returns the full entity. Let's slice it. |
67 if bytes: | 67 if bytes: |