Skip to content

Commit

Permalink
renaming error
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Neagu committed Dec 13, 2024
1 parent be58b0c commit 53e0728
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/service-library/src/servicelib/archiving_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ArchiveError(Exception):
"""


class UnsupportedArchiveFormat(Exception):
class UnsupportedArchiveFormatError(Exception):
pass


Expand Down Expand Up @@ -266,7 +266,7 @@ async def unarchive_dir(
)
# maybe write unsupported error format here instead of all this to be able to still raise in case of error
if isinstance(err, NotImplementedError):
raise UnsupportedArchiveFormat(msg) from err
raise UnsupportedArchiveFormatError(msg) from err

raise ArchiveError(msg) from err

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from pydantic import ByteSize
from servicelib.archiving_utils import (
PrunableFolder,
UnsupportedArchiveFormat,
UnsupportedArchiveFormatError,
archive_dir,
unarchive_dir,
)
Expand Down Expand Up @@ -281,10 +281,12 @@ async def _get_data_from_port(
if not downloaded_file or not downloaded_file.exists():
# the link may be empty
# remove files all files from disk when disconnecting port
_logger.debug("removing contents of dir %s", final_path)
await remove_directory(
final_path, only_children=True, ignore_errors=True
)
with log_context(
_logger, logging.DEBUG, f"removing contents of dir '{final_path}'"
):
await remove_directory(
final_path, only_children=True, ignore_errors=True
)
return port, None, ByteSize(0)

transferred_bytes = downloaded_file.stat().st_size
Expand All @@ -307,7 +309,7 @@ async def _get_data_from_port(
dest_folder.prune(exclude=unarchived)

_logger.debug("all unzipped in %s", final_path)
except UnsupportedArchiveFormat:
except UnsupportedArchiveFormatError:
_logger.warning(
"Could not extract archive '%s' to '%s' moving it to: '%s'",
downloaded_file,
Expand Down

0 comments on commit 53e0728

Please sign in to comment.