Skip to content

export ErrTagNotExist and ErrKeyNotExist sentinel errors - #29

Open
AdamMagued wants to merge 1 commit into
fatih:masterfrom
AdamMagued:feat-issue-24-export-sentinel-errors
Open

AdamMagued wants to merge 1 commit into
fatih:masterfrom
AdamMagued:feat-issue-24-export-sentinel-errors

Conversation

@AdamMagued

Copy link
Copy Markdown

Fixes #24.

Export sentinel errors returned by Parse, Get, and Set (ErrTagNotExist, ErrKeyNotExist, ErrKeyNotSet, ErrTagSyntax, ErrTagKeySyntax, ErrTagValueSyntax, and ErrTagKeyMismatch).

This allows callers to inspect errors using errors.Is(err, structtag.ErrTagNotExist) and errors.Is(err, structtag.ErrKeyNotExist) rather than string comparisons against error messages.

Internal references and unexported alias identifiers (errTagNotExist, errKeyNotExist, errKeyNotSet, etc.) remain defined for backward compatibility. Unit tests verify error matching via errors.Is.

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.

Unexported error sentinel values

1 participant