core/mise/errors.go
core/mise/errors.goBrowse 1970 files
188 tokens
805 bytes
Token encoding: o200k_base
Snapshot 21a254f
← Back to SKILL.md
1package mise2 3import (4 "errors"5 "fmt"6)7 8// TemporaryError marks a failure that is worth retrying: network transport9// errors, rate limits, and server-side errors. Deterministic failures (a 40410// for a version that does not exist, a malformed archive) are never wrapped in11// this, since retrying them cannot succeed.12type TemporaryError struct {13 URL string14 Err error15}16 17func (e *TemporaryError) Error() string {18 return fmt.Sprintf("temporary failure fetching %s: %s", e.URL, e.Err)19}20 21func (e *TemporaryError) Unwrap() error {22 return e.Err23}24 25// reports whether err (or anything it wraps) is a transient failure. Callers26// use this to decide whether retrying the whole operation makes sense.27func IsTemporary(err error) bool {28 var temporary *TemporaryError29 return errors.As(err, &temporary)30}31