errors

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 3 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must(result ...interface{}) interface{}

Must traps errors and returns the remaining results to the caller. If there is an error, a panic is issued.

func Print

func Print(err error)

Print print error to the stderr in red.

func Printf

func Printf(format string, args ...interface{})

Printf print a message to the stderr in red.

func Raise

func Raise(format string, args ...interface{})

Raise issues a panic with a formated message representing a managed error.

func Trap

func Trap(sourceErr error, recovered interface{}) (err error)

Trap catches any panic exception, and converts it to error. It must be called with current error state and recover() as argument.

Types

type Array

type Array []error

Array represent an array of error.

func (Array) AsError

func (errors Array) AsError() error

AsError returns nil if there is no error in the array.

func (Array) Error

func (errors Array) Error() string

type Managed

type Managed string

Managed indicates an error that is properly handled (no need to print out stack).

func (Managed) Error

func (err Managed) Error() string

type TemplateNotFoundError

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

TemplateNotFoundError is returned when a template does not exist.

func (TemplateNotFoundError) Error

func (e TemplateNotFoundError) Error() string

Jump to

Keyboard shortcuts

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