Documentation
¶
Overview ¶
Package errcompat provides boundary helpers that bridge legacy error types to the typed errs/ taxonomy. These helpers run at the dispatcher boundary (cmd/root.go.handleRootError) before the typed envelope writer, converting pre-typed-taxonomy errors (*core.ConfigError, *internalauth.NeedAuthorizationError) into typed *errs.* errors while preserving the original error in the Cause chain so existing `errors.As` callers continue to match.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PromoteAuthError ¶ added in v1.0.45
func PromoteAuthError(err *internalauth.NeedAuthorizationError) error
PromoteAuthError converts a legacy *internalauth.NeedAuthorizationError into *errs.AuthenticationError{Subtype: TokenMissing}. The Message field MUST contain "need_user_authorization" so the marker invariant guardrail in cmd/root_test.go and internal/auth/errors_test.go still holds.
Hint mirrors newTokenMissingError in internal/client/client.go so both token-missing surfaces converge on the same recovery vocabulary. cmd's applyNeedAuthorizationHint appends per-command scopes onto this Hint with a "\n" join, so the action prompt is preserved even when scopes are added.
Called from cmd/root.go.handleRootError when errors.As matches *NeedAuthorizationError, before WriteTypedErrorEnvelope.
func PromoteConfigError ¶
func PromoteConfigError(cfgErr *core.ConfigError) error
PromoteConfigError converts a legacy *core.ConfigError into the matching typed errs.*Error based on cfgErr.Type. Called from cmd/root.go.handleRootError before the typed envelope writer. The original *core.ConfigError is preserved in the Cause chain so external `errors.As(&core.ConfigError{})` callers (cmd/auth/list.go, cmd/doctor/doctor.go, etc.) still match.
Types ¶
This section is empty.