gh-113317: Argument Clinic: don't use fail() in CLI (#115513)

This commit is contained in:
Erlend E. Aasland 2024-02-15 13:10:32 +01:00 committed by GitHub
parent edb59d5718
commit 98ee4ecdbc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2500,12 +2500,12 @@ def parse_file(
extension = os.path.splitext(filename)[1][1:]
if not extension:
fail(f"Can't extract file type for file {filename!r}")
raise ClinicError(f"Can't extract file type for file {filename!r}")
try:
language = extensions[extension](filename)
except KeyError:
fail(f"Can't identify file type for file {filename!r}")
raise ClinicError(f"Can't identify file type for file {filename!r}")
with open(filename, encoding="utf-8") as f:
raw = f.read()