errorutil

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package errorutil provides functions to work with errors.

Index

Constants

View Source
const (
	FilterTraceExclude = 0 // Exclude the paths that match.
	FilterTraceInclude = 1 // Include only the paths that match.
)

Modes for FilterPatterns.

Variables

This section is empty.

Functions

func FilterTrace

func FilterTrace(err error, p *Patterns) error

FilterTrace removes unneeded stack traces from an error.

Types

type Patterns

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

Patterns for filtering error traces.

func FilterPattern

func FilterPattern(mode int, paths ...string) *Patterns

FilterPattern compiles filter patterns for FilterTrace()

Frames are filtered according to the mode; with FilterTraceExclude all frames are included except those that match the given patterns. With FilterTraceInclude all frames are excluded except those that match one of the patterns.

Paths starting with re: are treated as a regular expression.

Paths starting with match: are matched with filepath.Match()

Paths ending with .go are matches against the full file path (i.e. /home/martin/go/src/.../file.go).

Anything else is matches against the package path (i.e. github.com/foo/bar).

func (Patterns) Match

func (p Patterns) Match(pc uintptr) bool

Match a file path.

Jump to

Keyboard shortcuts

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