Documentation ¶
Overview ¶
Package transient allows you to tag and retry 'transient' errors (i.e. non-permanent errors which may resolve themselves by trying an operation again). This should be used on errors due to network flake, improperly responsive remote servers (e.g. status 500), unusual timeouts, etc. where there's no concrete knowledge that something is permanently wrong.
Said another way, transient errors appear to resolve themselves with nothing other than the passage of time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
Tag is used to indicate that an error is transient (i.e. something is temporarially wrong).
Functions ¶
func Only ¶
Only returns a retry.Iterator that wraps another retry.Iterator. It will fall through to the wrapped Iterator ONLY if an error with the transient.Tag is encountered; otherwise, it will not retry.
Returns nil if f is nil.
Example:
err := retry.Retry(c, transient.Only(retry.Default), func() error { if condition == "red" { // This error isn't transient, so it won't be retried. return errors.New("fatal bad condition") } elif condition == "green" { // This isn't an error, so it won't be retried. return nil } // This will get retried, because it's transient. return errors.New("dunno what's wrong", transient.Tag) })
Types ¶
This section is empty.