Documentation ¶
Overview ¶
Package xcontext provides Context with custom errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CancelFunc ¶
type CancelFunc func(err error)
CancelFunc is a function to cancel an associated context with a specified error. If a context is already canceled, calling this function has no effect. It panics if err is nil. Upon returning from this function, an associated context is guaranteed to be in a canceled state (i.e. Done channel is closed, Err returns non-nil).
func WithCancel ¶
func WithCancel(parent context.Context) (context.Context, CancelFunc)
WithCancel returns a context that can be canceled with arbitrary errors.
func WithDeadline ¶
WithDeadline returns a context that can be canceled with arbitrary errors on reaching a specified deadline. It panics if err is nil.
func WithTimeout ¶
WithTimeout returns a context that can be canceled with arbitrary errors on reaching a specified timeout. It panics if err is nil.