errors

package
v0.0.0-...-0fdeed9 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(severity Severity, desc string, args ...interface{}) error

New initializes the error, and optionally logs the error to the console depending on the severity.

func NewFromError

func NewFromError(severity Severity, err error) error

NewFromError initializes an NGError from an external error.

func SetMinimumSeverity

func SetMinimumSeverity(severity Severity)

SetMinimumSeverity sets the minimum severity level for which errors will be logged.

Types

type NGError

type NGError struct {
	Desc      string
	Created   time.Time
	Severity  Severity
	Arguments []interface{}
}

NGError is a custom error type which conforms to the Error interface.

func (*NGError) Error

func (e *NGError) Error() string

Error returns a description string for the error.

type Severity

type Severity int

Severity is used to denote the severity of a generated error.

const (
	// SeverityOK means that a generated error is OK, and is very unlikely to impact software effectiveness.
	SeverityOK Severity = 0
	// SeverityWarning means that a generated error has the potential to impact software effectiveness.
	SeverityWarning Severity = 1
	// SeverityFatal means that a generated error has impacted software effectivness.
	SeverityFatal Severity = 2
)

func (*Severity) ToString

func (s *Severity) ToString() string

ToString parses a severity type to a human-readable string.

Jump to

Keyboard shortcuts

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