##// END OF EJS Templates
errors: make OutOfBandError extend Abort...
Martin von Zweigbergk -
r47737:14ddb1dc default
parent child Browse files
Show More
@@ -304,10 +304,19 b' class ResponseExpected(Abort):'
304 Abort.__init__(self, _(b'response expected'))
304 Abort.__init__(self, _(b'response expected'))
305
305
306
306
307 class OutOfBandError(Hint, Exception):
307 class OutOfBandError(Abort):
308 """Exception raised when a remote repo reports failure"""
308 """Exception raised when a remote repo reports failure"""
309
309
310 __bytes__ = _tobytes
310 def __init__(self, *messages, **kwargs):
311 from .i18n import _
312
313 if messages:
314 message = _(b"remote error:\n%s") % b''.join(messages)
315 # Abort.format() adds a trailing newline
316 message = message.rstrip(b'\n')
317 else:
318 message = _(b"remote error")
319 super(OutOfBandError, self).__init__(message, **kwargs)
311
320
312
321
313 class ParseError(Abort):
322 class ParseError(Abort):
@@ -181,17 +181,6 b' def callcatch(ui, func):'
181 encoding.strtolocal(inst.strerror),
181 encoding.strtolocal(inst.strerror),
182 )
182 )
183 )
183 )
184 except error.OutOfBandError as inst:
185 detailed_exit_code = 100
186 if inst.args:
187 msg = _(b"abort: remote error:\n")
188 else:
189 msg = _(b"abort: remote error\n")
190 ui.error(msg)
191 if inst.args:
192 ui.error(b''.join(inst.args))
193 if inst.hint:
194 ui.error(b'(%s)\n' % inst.hint)
195 except error.RepoError as inst:
184 except error.RepoError as inst:
196 ui.error(_(b"abort: %s\n") % inst)
185 ui.error(_(b"abort: %s\n") % inst)
197 if inst.hint:
186 if inst.hint:
@@ -233,6 +222,8 b' def callcatch(ui, func):'
233 detailed_exit_code = 30
222 detailed_exit_code = 30
234 elif isinstance(inst, error.HookAbort):
223 elif isinstance(inst, error.HookAbort):
235 detailed_exit_code = 40
224 detailed_exit_code = 40
225 elif isinstance(inst, error.OutOfBandError):
226 detailed_exit_code = 100
236 elif isinstance(inst, error.SecurityError):
227 elif isinstance(inst, error.SecurityError):
237 detailed_exit_code = 150
228 detailed_exit_code = 150
238 elif isinstance(inst, error.CanceledError):
229 elif isinstance(inst, error.CanceledError):
General Comments 0
You need to be logged in to leave comments. Login now