errcompat

package
v1.0.45 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL