Mercurial > public > mercurial-scm > hg
comparison mercurial/error.py @ 43402:40bf3d7ecc42 stable
py3: add a __str__ method to Abort
This improves the rendering of some exceptions by avoiding raw
bytestrings, especially when using --traceback option.
author | Denis Laxalde <denis@laxalde.org> |
---|---|
date | Mon, 04 Nov 2019 16:13:01 +0100 |
parents | 687b865b95ad |
children | 822202e72f69 |
comparison
equal
deleted
inserted
replaced
43401:09537caa87f9 | 43402:40bf3d7ecc42 |
---|---|
108 | 108 |
109 class Abort(Hint, Exception): | 109 class Abort(Hint, Exception): |
110 """Raised if a command needs to print an error and exit.""" | 110 """Raised if a command needs to print an error and exit.""" |
111 | 111 |
112 __bytes__ = _tobytes | 112 __bytes__ = _tobytes |
113 | |
114 def __str__(self): | |
115 return pycompat.sysstr(self.__bytes__()) | |
113 | 116 |
114 | 117 |
115 class HookLoadError(Abort): | 118 class HookLoadError(Abort): |
116 """raised when loading a hook fails, aborting an operation | 119 """raised when loading a hook fails, aborting an operation |
117 | 120 |