deeperror: github.com/amattn/deeperror Index | Files | Directories

package deeperror

import "github.com/amattn/deeperror"

Index

Package Files

error.go version.go

func BuildNumber Uses

func BuildNumber() int64

func ErrorLoggingEnabled Uses

func ErrorLoggingEnabled() bool

enable/disable automatic logging of deeperrors upon creation

func ExecWithoutErrorLogging Uses

func ExecWithoutErrorLogging(action NoErrorsLoggingAction)

you can use this method to temporarily disable automatic logging of deeperrors

func Fatal Uses

func Fatal(num int64, endUserMsg string, parentErr error)

Convenince method. Equivalient to derr:=New(...); log.Fatal(derr)

func NewOrNilFromParent Uses

func NewOrNilFromParent(num int64, endUserMsg string, parentErr error) error

Convenince method. This will return nil if parrentErr == nil. Otherwise it will create a DeepError and return that.

func Version Uses

func Version() string

type DeepError Uses

type DeepError struct {
    Num           int64
    Filename      string
    CallingMethod string
    Line          int
    EndUserMsg    string
    DebugMsg      string
    DebugFields   map[string]interface{}
    Err           error // inner or source error
    StatusCode    int
    StackTrace    string
}

func New Uses

func New(num int64, endUserMsg string, parentErr error) *DeepError

Primary Constructor. Create a DeepError ptr with the given number, end user message and optional parent error.

func NewHTTPError Uses

func NewHTTPError(num int64, endUserMsg string, err error, statusCode int) *DeepError

HTTP variant. Create a DeepError with the given http status code

func NewTODOError Uses

func NewTODOError(num int64) *DeepError

Convenince method. creates a simple DeepError with the given error number. The error message is set to "TODO"

func (*DeepError) AddDebugField Uses

func (derr *DeepError) AddDebugField(key string, value interface{})

Add arbitrary debugging data to a given DeepError

func (*DeepError) Error Uses

func (e *DeepError) Error() string

Conform to the go built-in error interface http://golang.org/pkg/builtin/#error

func (*DeepError) StatusCodeIsDefaultValue Uses

func (e *DeepError) StatusCodeIsDefaultValue() bool

type NoErrorsLoggingAction Uses

type NoErrorsLoggingAction func()

anything performed in this anonymous function will not trigger automatic logging of deeperrors upon creation

Directories

PathSynopsis
levels

Package deeperror imports 5 packages (graph) and is imported by 5 packages. Updated 2016-07-15. Refresh now. Tools for package owners.