Catalist: Patch Exception Handling#1818
Conversation
|
In case it helps, here are rebuilt tests that actually use real files. |
awesome, appreciate you Ramona! looks like everything besides the label check was passing (and I've since fixed that) should I merge your branch into this one? or what's the standard operating procedure? |
|
Merging the tests before merging this PR is probably better in theory because it shows that the tests pass with the existing code, but I'm fine with either and will be doing PR reviews with @shaunagm this afternoon if it's preferred to handle them separately. |
shaunagm
left a comment
There was a problem hiding this comment.
approved and happy to merge once the tests pass (I assume they're not failing from this and the PR just needs to be updated)
|
They won't pass, the test suite needs to be changed. |
|
oh gotcha. i'll wait then! |
|
@IanRFerguson The tests have been merged into main. If you update this branch from main I think they'll all pass. |
|
hi @bmos - just want to make sure I'm tracking your changes correctly, should these checks be passing? |
|
Hm, idk why it's not passing now. |
| temp_file_zip = self.sftp.get_file( | ||
| remote_path=remote_filepath, export_chunk_size=DEFAULT_EXPORT_CHUNK_SIZE | ||
| ) |
There was a problem hiding this comment.
This will fix your test failure, not sure what happened here.
| temp_file_zip = self.sftp.get_file( | |
| remote_path=remote_filepath, export_chunk_size=DEFAULT_EXPORT_CHUNK_SIZE | |
| ) | |
| temp_file_zip = Path( | |
| self.sftp.get_file( | |
| remote_path=remote_filepath, | |
| export_chunk_size=DEFAULT_EXPORT_CHUNK_SIZE, | |
| ) | |
| ) |
| logger.debug( | ||
| f"Download complete for job {id} (local size: {temp_file_zip.stat().st_size} bytes)." | ||
| ) |
There was a problem hiding this comment.
On an unrelated note, you might also want to use lazy formatting in your logger call, since f-strings are resolved even when the logger is not in debug mode.
| logger.debug( | |
| f"Download complete for job {id} (local size: {temp_file_zip.stat().st_size} bytes)." | |
| ) | |
| logger.debug( | |
| "Download complete for job %s (local size: %s bytes).", id, temp_file_zip.stat().st_size | |
| ) |
What is this change?
Adds an exception for clarity in the
CatalistMatchclass if there is a failure to save the zipped file from the vendor's SFTP server. The current active exception is raising onzf.extractall(path=temp_dir), which tells us there's a problem with the file but not much else.Breaking changes (if needed)
This is not a breaking change.
Considerations for discussion
N/A
How to test the changes (if needed)
Labels
Please add exactly one of the following labels to this PR:
breaking-change— This PR introduces a breaking change to the public APInon-breaking-change— This PR does not break any existing functionalityThe label check CI job will fail until one of these labels is applied.