-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add option to set upload chunk size in project config #53
Conversation
Minimum allowed coverage is Generated by 🐒 cobertura-action against 2a3fae5 |
buildstockbatch/gcp/gcp.py
Outdated
) | ||
except requests.exceptions.ConnectionError: | ||
logger.error("Error while uploading files to GCS bucket.") | ||
logger.error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I think it'd be better for this to be just one log message.
-
Logging and rethrowing is somewhat of an anti-pattern, though I'm less sure about that for Python (but I think the principles still apply).
- How that applies here, theoretically, is that the stack trace (which tells us whether this is a timeout error or something else) could be distant from this message about it. Admittedly, in this case there probably won't be any distance.
Given those, I think what you should do instead is raise a new exception (that contains this info) chained with the original exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point - fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This looks great!
Testing:
ConnectionError(ProtocolError('Connection aborted.', TimeoutError('The write operation timed out')))
.