Skip to content

Conversation

@olib963
Copy link
Contributor

@olib963 olib963 commented Mar 13, 2025

Similar to #54, we're currently marshalling boolean pointers incorrectly. If you Marshal a terrors.Error then Unmarshal it again you will get &false if the input was either nil or &false leading to a loss in data.

We might consider this a breaking change due to Hyrum's Law. While the Unexpected() and Retryable() functions will have the same output, the underlying fields will now be nil where they were not before.


if tc.platErr.IsRetryable == nil {
assert.False(t, protoError.Retryable.Value)
assert.Nil(t, protoError.Retryable)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the behaviour change.


if tc.platErr.IsUnexpected == nil {
assert.False(t, protoError.Unexpected.Value)
assert.Nil(t, protoError.Unexpected)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

And here

@olib963 olib963 marked this pull request as ready for review March 13, 2025 18:17
@olib963 olib963 merged commit bef380b into master Mar 18, 2025
2 checks passed
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.

3 participants