errcontext

package
v1.0.0-alpha1.0...-2e0dbe4 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package errcontext defines a context-aware error handling mechanism using interfaces and a struct that allows sending and receiving a single error.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyCalled = fmt.Errorf("already called")
)

Functions

This section is empty.

Types

type ErrCloseSender

type ErrCloseSender interface {
	ErrCloser
	ErrSender
}

ErrCloseSender embeds ErrCloser and ErrSender interfaces.

type ErrCloser

type ErrCloser interface {
	Close()
}

ErrCloser defines the method to close an error

type ErrContexer

type ErrContexer interface {
	ErrCloser
	ErrReceiver
	ErrSender
}

ErrContexer embeds ErrReceiver, ErrSender and ErrCloser interfaces.

func New

func New(ctx context.Context) ErrContexer

New creates ErrContexer with an error channel and context. When used ctx is nil, background context is used => Receive() calls are blocking until Send call or Close call.

type ErrReceiver

type ErrReceiver interface {
	Receive() error
}

ErrReceiver defines the method to receive an error.

type ErrSender

type ErrSender interface {
	Send(error)
}

ErrSender defines the method to send an error.

Jump to

Keyboard shortcuts

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