Skip to content

Commit

Permalink
Simplify unknown-extension error message (#584)
Browse files Browse the repository at this point in the history
  • Loading branch information
maddenp-noaa authored Aug 20, 2024
1 parent a99fe8f commit 448318f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/uwtools/utils/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from typing import IO, Any, Generator, Optional, Union

from uwtools.exceptions import UWError
from uwtools.logging import log
from uwtools.strings import FORMAT


Expand Down Expand Up @@ -52,10 +51,9 @@ def get_file_format(path: Path) -> str:
suffix = Path(path).suffix.replace(".", "")
try:
return FORMAT.formats()[suffix]
except KeyError as e:
except KeyError:
msg = f"Cannot deduce format of '{path}' from unknown extension '{suffix}'"
log.critical(msg)
raise UWError(msg) from e
raise UWError(msg) from None


def path_if_it_exists(path: str) -> str:
Expand Down

0 comments on commit 448318f

Please sign in to comment.