errors

package
v0.0.0-...-83625b3 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fail

func Fail(code int, err error)

Fail calls HandleError on the Error object inside the request context.

func New

func New(message string) error

New is a replacement function for errors.New().

This function constructs a Error where both the diagnostic error and the end user error is the same.

func NewMultiError

func NewMultiError(errs []error) error

Types

type Error

type Error interface {
	// Error that is displayed in the logs and debug messages. Should contain diagnostical information.
	Error() string
	// UserError is an error that is displayed to the end user.
	UserError(t func(string, map[string]string) string) string
}

Error extends the built-in error interface with a message that is displayed to the end user.

func NewError

func NewError(err, message string, params map[string]string) Error

NewError creates a new verbose error message.

If err is an empty string, then message will be used it instead.

func Wrap

func Wrap(err error, message string, params map[string]string) Error

Wrap wraps an error message into a Error.

type Panic

type Panic struct {
	Code          int
	Err           error
	StackTrace    string
	DisplayErrors bool
}

Panic is a custom panic data structure for the ErrorHandler.

func (Panic) Error

func (p Panic) Error() string

func (Panic) String

func (p Panic) String() string

func (Panic) UserError

func (p Panic) UserError(t func(string, map[string]string) string) string

Jump to

Keyboard shortcuts

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