batch

package
v3.29.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package batch contains internal utilities for interacting with message batches.

Package batch contains internal utilities for interacting with message batches.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is an error type that also allows storing granular errors for each message of a batch.

func NewError

func NewError(msg types.Message, err error) *Error

NewError creates a new batch-wide error, where it's possible to add granular errors for individual messages of the batch.

func (*Error) Error

func (e *Error) Error() string

Error implements the common error interface.

func (*Error) Failed

func (e *Error) Failed(i int, err error) *Error

Failed stores an error state for a particular message of a batch. Returns a pointer to the underlying error, allowing with method to be chained.

If Failed is not called then all messages are assumed to have failed. If it is called at least once then all message indexes that aren't explicitly failed are assumed to have been processed successfully.

func (*Error) IndexedErrors

func (e *Error) IndexedErrors() int

IndexedErrors returns the number of indexed errors that have been registered for the batch.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the underlying common error.

func (*Error) WalkParts

func (e *Error) WalkParts(fn func(int, types.Part, error) bool)

WalkParts applies a closure to each message that was part of the request that caused this error. The closure is provided the message part index, a pointer to the part, and its individual error, which may be nil if the message itself was processed successfully. The closure returns a bool which indicates whether the iteration should be continued.

Jump to

Keyboard shortcuts

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