Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #212
What changed
wrapTimeParseLocationErrornow always wraps errors fromtime.LoadLocationwith a stable message (invalid time zone format: %w), instead of only when the error text contains "unknown time zone" / starts with "time: unknown format" and leaking everything else raw.Why
Go stdlib's
loadLocationreturns the first non-ENOENT error from the platform zone sources (e.g.operation not permitted/ EACCES on sandboxed darwin) before falling back to the embeddedtime/tzdata. Only when every source is ENOENT does it emitunknown time zone <name>. Depending on the host, the hook therefore leaked raw syscall errors into decoding errors, breaking portable error handling and user-facing messages.Behavior change detail
The wrapped error keeps its
invalid time zone format:prefix, but the trailing text is now whatevertime.LoadLocationreturned (e.g.unknown time zone Mars/Olympus_Monson Linux,operation not permittedon sandboxed darwin). No existing test in this repo asserted the raw syscall text; regression tests added for the raw-error path, wrapping preservation (errors.Is), and the nil passthrough.