errs

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2016 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int
	Name    string
	Package string
	// contains filtered or unexported fields
}

Error implements the standard go error interface.

errors.New(code, format, params ...interface{})

Prints as:

[package] description: details

where details is fmt.Sprintf(self.format, self.params...)

func (Error) Error

func (self Error) Error() (message string)

func (*Error) Fatal

func (self *Error) Fatal() (fatal bool)

err.Fatal() is true if err's severity level is 0 or 1 (logger.ErrorLevel or logger.Silence)

func (Error) Log

func (self Error) Log(v glog.Verbose)

type Errors

type Errors struct {
	Errors  map[int]string
	Package string
	Level   func(code int) logger.LogLevel
}

Errors implements an error handler providing standardised errors for a package. Fields:

Errors:
 a map from error codes to description

Package:
 name of the package/component

Level:
 a function mapping error code to logger.LogLevel (severity)
 if not given, errors default to logger.InfoLevel

func (*Errors) New

func (self *Errors) New(code int, format string, params ...interface{}) *Error

Jump to

Keyboard shortcuts

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