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

fix: handle a corrupt stash.json file #291

Merged
merged 2 commits into from
Nov 11, 2021
Merged

Conversation

shetzel
Copy link
Contributor

@shetzel shetzel commented Nov 8, 2021

What does this PR do?

When a JsonParseError is thrown while reading stash.json for the deploy ID, the error is now caught, the file is renamed to stash.json_corrupted_ and an error message is displayed that shows the parse failure and the location of the renamed stash.json so users can inspect the file, or possibly rebuild a valid file from the corrupt version.

What issues does this PR fix or reference?

@W-7837761@

Testing:

  1. change stash.json to be invalid json
  2. delete stash.json
  3. change stash.json to be empty

In all cases an error should be thrown. In 1 & 3 the stash.json file will be renamed so running the command again will not result in the same behaviour.

Copy link
Contributor

@mshanemc mshanemc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a fine solution for a rare problem

@shetzel shetzel merged commit ac15a24 into main Nov 11, 2021
@shetzel shetzel deleted the sh/handle-corrupt-stash branch November 11, 2021 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants