Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

review and improve error handling when invoking makedirs #1365

Merged
merged 2 commits into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sarracenia/flow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@ def mkdir(self, msg) -> bool:
except Exception as ex:
logger.warning("making %s: %s" % (msg['new_dir'], ex))
logger.debug('Exception details:', exc_info=True)
return False

if os.path.isdir(path):
logger.debug( f"no need to mkdir {path} as it exists" )
Expand Down Expand Up @@ -1708,6 +1709,7 @@ def link1file(self, msg, symbolic=True) -> bool:
except Exception as ex:
logger.warning("making %s: %s" % (msg['new_dir'], ex))
logger.debug('Exception details:', exc_info=True)
return False

ok = True
try:
Expand Down Expand Up @@ -1774,6 +1776,8 @@ def do_download(self) -> None:
except Exception as ex:
logger.warning("making %s: %s" % (msg['new_dir'], ex))
logger.debug('Exception details:', exc_info=True)
self.reject(msg, 422, f"cannot create directory {msg['new_dir']} to put file in it." )
continue

os.chdir(msg['new_dir'])
logger.debug( f"chdir {msg['new_dir']}")
Expand Down
Loading