You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Go SDK: an opaque value's decrypt error, and an out-of-range integer's, still say something about the decrypted value #2008
The Go SDK reads each decrypted field into the program's Go type through encrypt/gensupport. #2005 and #2006 set a rule for errors: an error may name a value's kind only where the kind is visible without decrypting, meaning input the caller sent or the stored record's own structure. It never names what a decrypted value opened as. The type tag sits inside the encrypted envelope, and errors are often logged.
Problem
Two decrypt errors still say something about the decrypted value:
An opaque value.gensupport's Opaque wraps the error from vcffi.UnmarshalStorage with %w. That error's text names the kind it found and where, for a decrypted opaque value. Removing the text while keeping errors.Is(err, ErrStorageVersion) working needs a small wrapper type.
An integer out of range.outOfRange writes "the stored value does not fit a %T". It names only the target type, but it says the decrypted number is outside that type's range, which tells a reader something about the value's size.
Verified: both by reading the code on #2006's branch. Not checked: whether a caller logs these errors by default.
Proposal
For Opaque, wrap the storage error in a type whose Error() names only the field and the target type, and whose Unwrap keeps errors.Is(err, ErrStorageVersion) working. Add a test that the message names no kind.
For outOfRange, decide whether "does not fit" is acceptable. If not, merge it with the plain "does not open as %T" refusal. A test should pin whichever wording is chosen.
Activity