Add Support for Partial Exports and Imports #497
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables the CLI to still export partial exports to files in cases when errors would've normally prevented it. In other words, this PR addresses this issue.
See my PR in the library which makes changes there to enable the changes in this PR to work.
One thing I wasn't sure about was how we should handle error handling in the cases of partial exports. Currently, the way it handles errors is to first save any exports that were successful, then check if any errors occurred during export. If any error occurred during export, it will print out the error, and then the command will fail with status code 1. I feel like this could be sort of misleading however because the command didn't necessarily "fail" since it did export some configuration successfully, so I'm wondering if printing the error in these cases would be sufficient, or if this is a case where we want to return a specific status code instead of the generic error 1 code to indicate it was semi-successful.
Either way, I also updated the tests to check for the status code after an export is made to verify that it is what was expected. This change is what resulted in most of the changes in the different snapshots that were updated.