Mercurial > hg-stable
comparison mercurial/error.py @ 46981:abd18d6306f1
errors: remove unnecessary varargs handling from OutOfBandError
In my recent D10465, I moved some code over from scmutil into
`OutOfBandError.__init__`. The code was written to deal with an
arbitrary number of `message` arguments to the constructor. It turns
out that we only ever pass 0 or 1. Given that, let's simplify it.
Differential Revision: https://phab.mercurial-scm.org/D10483
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 19 Apr 2021 21:31:24 -0700 |
parents | f9482db16cef |
children | 33c0c25d0b0f |
comparison
equal
deleted
inserted
replaced
46980:75351b8b2082 | 46981:abd18d6306f1 |
---|---|
309 | 309 |
310 | 310 |
311 class OutOfBandError(RemoteError): | 311 class OutOfBandError(RemoteError): |
312 """Exception raised when a remote repo reports failure""" | 312 """Exception raised when a remote repo reports failure""" |
313 | 313 |
314 def __init__(self, *messages, **kwargs): | 314 def __init__(self, message=None, hint=None): |
315 from .i18n import _ | 315 from .i18n import _ |
316 | 316 |
317 if messages: | 317 if message: |
318 message = _(b"remote error:\n%s") % b''.join(messages) | |
319 # Abort.format() adds a trailing newline | 318 # Abort.format() adds a trailing newline |
320 message = message.rstrip(b'\n') | 319 message = _(b"remote error:\n%s") % message.rstrip(b'\n') |
321 else: | 320 else: |
322 message = _(b"remote error") | 321 message = _(b"remote error") |
323 super(OutOfBandError, self).__init__(message, **kwargs) | 322 super(OutOfBandError, self).__init__(message, hint=hint) |
324 | 323 |
325 | 324 |
326 class ParseError(Abort): | 325 class ParseError(Abort): |
327 """Raised when parsing config files and {rev,file}sets (msg[, pos])""" | 326 """Raised when parsing config files and {rev,file}sets (msg[, pos])""" |
328 | 327 |