comparison mercurial/error.py @ 43417:822202e72f69 stable

py3: do not reimplement Abort.__str__() on Python 2 It isn't necessary on Python 2, and the default implementation should be better than our BaseException_str() clone.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 05 Nov 2019 21:29:40 +0900
parents 40bf3d7ecc42
children ca3dca416f8d
comparison
equal deleted inserted replaced
43416:e7eb67eab53f 43417:822202e72f69
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 113
114 def __str__(self): 114 if pycompat.ispy3:
115 return pycompat.sysstr(self.__bytes__()) 115
116 def __str__(self):
117 return pycompat.sysstr(self.__bytes__())
116 118
117 119
118 class HookLoadError(Abort): 120 class HookLoadError(Abort):
119 """raised when loading a hook fails, aborting an operation 121 """raised when loading a hook fails, aborting an operation
120 122