errors

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 6 Imported by: 0

README

go.nownabe.dev/errors

GoDoc License Go Report Card GolangCI

Documentation

Index

Constants

View Source
const (
	// KindBadRequest is a kind.
	KindBadRequest = http.StatusBadRequest
	// KindUnauthorized is a kind.
	KindUnauthorized = http.StatusUnauthorized
	// KindForbidden is a kind.
	KindForbidden = http.StatusForbidden
	// KindNotFound is a kind.
	KindNotFound = http.StatusNotFound
	// KindUnexpected is a kind.
	KindUnexpected = http.StatusInternalServerError
)

Variables

This section is empty.

Functions

func E

func E(op Op, args ...interface{}) error

E constructs an error.

func Is

func Is(err error, kind int) bool

Is checks error's kind.

func Kind

func Kind(err error) int

Kind returns error's kind.

func KindText

func KindText(err error) string

KindText returns a friendly string of the Kind type.

func Level

func Level(err error) log.Level

Level returns error's level.

func Msg

func Msg(err error) string

Msg returns error message for clients.

func New added in v1.0.1

func New(msg string) error

New constructs a new error.

func Ops

func Ops(err error) []string

Ops aggregates the error's operations with embedded errors.

func Stacktrace

func Stacktrace(err error) [][3]string

Stacktrace returns an array of stacktrace tupples that inclues function, file and line.

Types

type Op

type Op string

Op describes packages and functions.

Jump to

Keyboard shortcuts

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