authretry

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package authretry exposes the AuthRefreshRequired marker error used by edition overlays (in separate Go modules) to signal "the current access token was rejected by the server; please run a force-refresh and retry".

The package has no dependencies beyond the standard library so it can be imported by both the runner (internal/app) and external overlays without creating import cycles with packages such as pkg/runtimetoken.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRefreshRequired

type AuthRefreshRequired struct {
	// Cause is the underlying user-facing error. The runner returns Cause
	// (not the wrapper) when refresh fails or the retry budget is exhausted,
	// so end users always see the original diagnostic instead of an internal
	// "auth refresh required" message.
	Cause error
}

AuthRefreshRequired is a marker error returned by overlays (typically from the edition's ClassifyToolResult or OnAuthError hook) to ask the runner to perform a one-shot ForceRefresh of the access token and retry the current invocation.

Open-source code paths never produce this type, so the runner's retry branch is a no-op for editions that don't opt in.

func As

func As(err error) (*AuthRefreshRequired, bool)

As walks the error chain and returns the first *AuthRefreshRequired it finds, along with true. Returns nil, false otherwise.

Use this instead of a plain errors.As when callers care about acting on the marker (force-refresh + retry) rather than just identifying the underlying error class.

func (*AuthRefreshRequired) Error

func (e *AuthRefreshRequired) Error() string

Error returns the underlying cause's message, or a generic fallback when Cause is nil.

func (*AuthRefreshRequired) Unwrap

func (e *AuthRefreshRequired) Unwrap() error

Unwrap exposes the underlying cause to errors.Is / errors.As.

Jump to

Keyboard shortcuts

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