Back to / errorutil

Package errorutil

Latest Go to latest

The latest major version is .

Published: Mar 16, 2020 | License: MIT | Module:


Package errorutil provides functions to work with errors.



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

Modes for FilterPatterns.

func FilterTrace

func FilterTrace(err error, p *Patterns) error

FilterTrace removes unneeded stack traces from an error.

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.

func (Patterns) Match

func (p Patterns) Match(pc uintptr) bool

Match a file path.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier