gerror

package
v1.8.4-0...-cbac34e Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package errors provides simple functions to manipulate errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

Cause returns the root cause error.

func New

func New(text string) error

New returns an error that formats as the given text.

func Newf

func Newf(format string, args ...interface{}) error

Newf returns an error that formats as the given text.

func Stack

func Stack(err error) string

Stack returns the stack callers as string. It returns an empty string id the <err> does not support stacks.

func Wrap

func Wrap(err error, text string) error

Wrap wraps error with text. It returns nil if given err is nil.

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Wrapf returns an error annotating err with a stack trace at the point Wrapf is called, and the format specifier. It returns nil if given err is nil.

Types

type ApiCause

type ApiCause interface {
	Cause() error
}

type ApiStack

type ApiStack interface {
	Stack() string
}

type Error

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

Error is custom error for additional features.

func (*Error) Cause

func (err *Error) Cause() error

Cause returns the root cause error.

func (*Error) Error

func (err *Error) Error() string

Error implements the interface of Error, it returns the error as string.

func (*Error) Format

func (err *Error) Format(s fmt.State, verb rune)

Format formats the frame according to the fmt.Formatter interface.

%v, %s : Print the error string; %-v, %-s : Print current error string; %+s : Print full stack error list; %+v : Print the error string and full stack error list;

func (*Error) Stack

func (err *Error) Stack() string

Stack returns the stack callers as string. It returns an empty string id the <err> does not support stacks.

Jump to

Keyboard shortcuts

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