MCPcopy
hub / github.com/pallets/click / FileError

Class FileError

src/click/exceptions.py:342–359  ·  view source on GitHub ↗

Raised if a file cannot be opened.

Source from the content-addressed store, hash-verified

340
341
342class 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
362class Abort(RuntimeError):

Callers 2

openMethod · 0.85

Calls

no outgoing calls

Tested by 1