framerr

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: BSD-2-Clause Imports: 5 Imported by: 0

README

framerr

Extract frame information from Go error values

GoDoc Alpha Quality Build Status GitHub tag BSD license codecov Go Report Card


Introduction

Introduction | Usage | Contributing

🚧 Disclaimer: framerr is alpha quality software. The API may change without warning between revisions. 🚧

framerr extracts stack frame information for Go2 error values

Usage

Introduction | Usage | Contributing

As Go2 error value stack frame information is not programatically accessible, you can use framerr to extract a slice of frames from an error chain.

err1 := xerrors.New("an error")
err2 := cling.Wrap(err1, "wrapped")

// ...

frames := framerr.Extract(err)

Each Frame holds the error message, and a Source field that contains file, package, function, and line information. Use these details to send stack info to your favorite error tracking service!

For complete examples and usage, see the GoDoc documentation.

Contributing

Introduction | Usage | Contributing

I would love your help!

framerr is still a work in progress. You can help by:

  • Opening a pull request to resolve an open issue.
  • Adding a feature or enhancement of your own! If it might be big, please open an issue first so we can discuss it.
  • Improving this README or adding other documentation to framerr.
  • Letting me know if you're using framerr.

Documentation

Overview

Package framerr provides programatic extraction of stack from information from Go2 error values.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame struct {
	Text string

	Source *struct {
		Package string
		Func    string
		File    string
		Line    int
	}
}

Frame represents a single error frame, including its message, and the stack frame location information, if available.

If no stack frame information is available, Source will be nil. If the information is available, all fields on Source will be set.

func Extract

func Extract(err error) []Frame

Extract the Frames that are contained in the error. Errors must implement the xerrors.Formatter interface to be able to extract error chains and stack frame source details.

Jump to

Keyboard shortcuts

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