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

Stringify S3 delete errors #555

Closed

Conversation

hifi
Copy link
Collaborator

@hifi hifi commented Jan 5, 2024

The error doesn't necessary have all fields and we can end up dereferencing a nil pointer causing a panic.

An example of such error after this commit:

time=2024-01-05T09:37:07.100+02:00 level=ERROR msg="retainer error" db=/home/hifi/git/beeper/litestream/restore.db replica=backblaze-eu error="delete wal segments before index: delete wal segments: deleting object: {\n  Code: \"MalformedXML\",\n  Messa
ge: \"The XML you provided was not well-formed or did not validate against our published schema\"\n}"

In this instance, B2 is having issues but doesn't provide a Key in the error which the code assumes to always exist. Since the struct has a String() method the safe solution and is only used in errors so the formatting isn't critical.

The error doesn't necessary have all fields and we can end up
dereferencing a nil pointer causing a panic.
hifi added a commit to beeper/litestream that referenced this pull request Jan 5, 2024
The SDK provides helper functions when you want an empty value if
the actual one is nil so we can just wrap all of them to avoid getting
bit.

Fixes benbjohnson#556
Replaces benbjohnson#555

Also fixes another panic when getting a delete error without key.
@hifi
Copy link
Collaborator Author

hifi commented Jan 5, 2024

Superseded by #557

@hifi hifi closed this Jan 5, 2024
hifi added a commit to beeper/litestream that referenced this pull request Jan 5, 2024
The SDK provides helper functions when you want an empty value if
the actual one is nil so we can just wrap all of them to avoid getting
bit.

Fixes benbjohnson#556
Replaces benbjohnson#555

Also fixes another panic when getting a delete error without key.
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.

None yet

1 participant