Raised if a file cannot be opened.
| 340 | |
| 341 | |
| 342 | class FileError(ClickException): |
| 343 | """Raised if a file cannot be opened.""" |
| 344 | |
| 345 | ui_filename: t.Final[str] |
| 346 | filename: t.Final[str] |
| 347 | |
| 348 | def __init__(self, filename: str, hint: str | None = None) -> None: |
| 349 | if hint is None: |
| 350 | hint = _("unknown error") |
| 351 | |
| 352 | super().__init__(hint) |
| 353 | self.ui_filename = format_filename(filename) |
| 354 | self.filename = filename |
| 355 | |
| 356 | def format_message(self) -> str: |
| 357 | return _("Could not open file {filename!r}: {message}").format( |
| 358 | filename=self.ui_filename, message=self.message |
| 359 | ) |
| 360 | |
| 361 | |
| 362 | class Abort(RuntimeError): |
no outgoing calls