Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // PanicError is returned when a panic is recovered // during the execution of a goroutine PanicError = fmt.Errorf("recovered from panic") )
Functions ¶
Types ¶
type Routine ¶
type Routine struct {
// contains filtered or unexported fields
}
Routine is a handle to a goroutine's error response. Panics that occur in this routine are converted into errors.
func Go ¶
Go launches a goroutine that will return an error if the provided func panics or an error is returned by the provided func.
type RoutineGroup ¶
RoutineGroup is a wrapper around golang.org/x/sync/errgroup.Group that recovers from panics and returns them as errors
func NewGroup ¶
func NewGroup(ctx context.Context) (*RoutineGroup, context.Context)
NewGroup instantiates an RoutineGroup and corresponding context. This function should be used the same way as errgroup.WithContext() from golang.org/x/sync/errgroup
func (*RoutineGroup) Go ¶
func (rg *RoutineGroup) Go(f func() error)
Go runs a provided func in a goroutine while ensuring that any panic is recovered and returned as an error
Click to show internal directories.
Click to hide internal directories.