catch

package
v0.37.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: GPL-2.0, GPL-3.0 Imports: 5 Imported by: 0

README

catch - Error Handling Middleware

Arguments

Error Handling Pipeline

The catch middleware handles stderr output by passing it as stdin to another pipe. The error handling pipe can be referenced either by a string (referencing a pipe defined elsewhere) or a map, providing additional arguments.

The handling pipe's stdout (if any) will be added to the calling pipe's stdout. Any stderr output from the error handling pipe will also be passed to the calling pipe, replacing the previous stderr output.

Note that the error handling pipe will only be invoked if the calling pipe has non-trivial stderr output.

String Reference
private:
    some-pipe:
        # use a string to refer to a pipe defined elsewhere
        catch: error-handling-pipe

    # this is the definition
    error-handling-pipe:
        # a map of arguments that define the handling pipe's behavior
        invocation: arguments
Map Reference
private:
    some-pipe:
        catch:
            # pass a map to provide additional arguments to the error handling pipe
            # this can also be used to overwrite arguments in the definition
            # or to define the entire pipe inline
            error-handling-pipe:
                # these additional arguments will be merged into the definition's default arguments
                invocation: arguments

    # the definition is optional
    error-handling-pipe:
        # default arguments may be overwritten by invocation arguments
        default: arguments

Documentation

Overview

Package catch provides a middleware for graceful handling of stderr output

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Middleware added in v0.32.2

type Middleware struct {
}

Middleware implements a handler for stderr output

func NewMiddleware added in v0.32.2

func NewMiddleware() Middleware

NewMiddleware creates a new Middleware instance

func (Middleware) Apply added in v0.32.2

func (catchMiddleware Middleware) Apply(
	run *pipeline.Run,
	next func(*pipeline.Run),
	executionContext *middleware.ExecutionContext,
)

Apply is where the middleware's logic resides

It adapts the run based on its slice of the run's arguments. It may also trigger side effects such as executing shell commands or full runs of other pipelines. When done, this function should call next in order to continue unwinding the stack.

func (Middleware) String added in v0.32.2

func (Middleware) String() string

String is a human-readable description

Jump to

Keyboard shortcuts

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