Skip to content

Commit

Permalink
Add a more useful error message when a directory is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidHuber-NOAA committed Nov 14, 2024
1 parent c5687cf commit da60838
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wxflow/fsutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ def rmdir(dir_path, missing_ok=False):
try:
shutil.rmtree(dir_path)

except FileNotFoundError as exc:
except FileNotFoundError:
if missing_ok:
logger.warning(f"WARNING cannot remove the target path {dir_path} because it does not exist")
else:
raise exc
raise FileNotFoundError(f"Target directory ({dir_path}) cannot be removed because it does not exist")

except OSError:
raise OSError(f"Unable to remove the target directory: {dir_path}")

Check warning on line 39 in src/wxflow/fsutils.py

View check run for this annotation

Codecov / codecov/patch

src/wxflow/fsutils.py#L38-L39

Added lines #L38 - L39 were not covered by tests
Expand Down

0 comments on commit da60838

Please sign in to comment.