Mercurial > public > mercurial-scm > hg
comparison mercurial/error.py @ 50329:3dbc7b1ecaba stable
typing: correct the signature of error.CommandError
There's a place in `mercurial.dispatch._parse()` that passes None if a parse
error happens before the command can be parsed out, and casting the error to
bytes works fine because the command and message fields are apparently ignored.
Likewise, TortoiseHg similarly passes None for the same reason.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Fri, 24 Mar 2023 02:22:12 -0400 |
parents | 642e31cb55f0 |
children | bf16ef96defe |
comparison
equal
deleted
inserted
replaced
50328:1b3aa9762d3a | 50329:3dbc7b1ecaba |
---|---|
153 | 153 |
154 class CommandError(Exception): | 154 class CommandError(Exception): |
155 """Exception raised on errors in parsing the command line.""" | 155 """Exception raised on errors in parsing the command line.""" |
156 | 156 |
157 def __init__(self, command, message): | 157 def __init__(self, command, message): |
158 # type: (bytes, bytes) -> None | 158 # type: (Optional[bytes], bytes) -> None |
159 self.command = command | 159 self.command = command |
160 self.message = message | 160 self.message = message |
161 super(CommandError, self).__init__() | 161 super(CommandError, self).__init__() |
162 | 162 |
163 __bytes__ = _tobytes | 163 __bytes__ = _tobytes |