/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/errors.py

  • Committer: Robert Collins
  • Date: 2007-04-26 01:48:29 UTC
  • mto: This revision was merged to the branch mainline in revision 2457.
  • Revision ID: robertc@robertcollins.net-20070426014829-znbzqzsk1gq68xqh
Fix the 'Unprintable error' message display to use the repr of the
exception that prevented printing the error because the str value for it
is often not useful in debugging (e.g.  KeyError('foo') has a str() of
'foo' but a repr of 'KeyError('foo')' which is much more useful.
(Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
                    return s.encode('utf8')
103
103
                return s
104
104
        except (AttributeError, TypeError, NameError, ValueError, KeyError), e:
105
 
            return 'Unprintable exception %s: dict=%r, fmt=%r, error=%s' \
 
105
            return 'Unprintable exception %s: dict=%r, fmt=%r, error=%r' \
106
106
                % (self.__class__.__name__,
107
107
                   self.__dict__,
108
108
                   getattr(self, '_fmt', None),
109
 
                   str(e))
 
109
                   e)
110
110
 
111
111
    def _get_format_string(self):
112
112
        """Return format string for this exception or None"""
154
154
                return s.encode('utf8')
155
155
            return s
156
156
        except (TypeError, NameError, ValueError, KeyError), e:
157
 
            return 'Unprintable exception %s(%r): %s' \
 
157
            return 'Unprintable exception %s(%r): %r' \
158
158
                % (self.__class__.__name__,
159
 
                   self.__dict__, str(e))
 
159
                   self.__dict__, e)
160
160
 
161
161
 
162
162
class AlreadyBuilding(BzrError):