[BUG] HTTPError instance has no attribute 'errno'

Aaron Bentley aaron.bentley at utoronto.ca
Wed Nov 16 02:05:59 GMT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alexander Belchenko wrote:
| "exception HTTPError
|    A subclass of URLError, it can also function as a non-exceptional
| file-like return value (the same thing that urlopen() returns). This is
| useful when handling exotic HTTP errors, such as requests for
| authentication."
| Well, I'm definitely got "exotic HTTP error", probably John know how
| much exotic?

Strangely, I only get boring connection timeouts from John's branch.

It's stupid that they claim to be a subclass of IOError without an errno
member, but I guess we should just throw in an extra hasattr:

=== modified file 'bzrlib/commands.py'
- --- bzrlib/commands.py
+++ bzrlib/commands.py
@@ -511,6 +511,8 @@
~         try:
~             return func(*args, **kwargs)
~         except IOError, e:
+            if not hasattr(e, "errno"):
+                raise
~             if e.errno != errno.EPIPE:
~                 raise
~         except KeyboardInterrupt:

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDepQG0F+nu1YWqI0RAgx6AJ9SeP1KrT63yMG6GXVaBKZuj5h0LACePwyC
8x4M3ha6vqEp7sSOpUdGMTo=
=oRdm
-----END PGP SIGNATURE-----




More information about the bazaar mailing list