errors

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCode

func GetCode(err error) string

GetCode returns the error code

func Is

func Is(err error) bool

Is returns is the error object is valid

Types

type Error

type Error struct {
	Code        string
	Severity    Severity
	Description []interface{}
}

Error defines the attributes of an error

func New

func New(code string, severity Severity, description ...interface{}) *Error

New instantiates a new instance of error object

func (*Error) Error

func (e *Error) Error() string

Error returns the error description

type Severity

type Severity string

Severity describes the severity level of the error

const (
	// Emergency level severity
	Emergency Severity = "emergency"
	// NoneSeverity level severity
	NoneSeverity Severity = "none"
	// Warn level severity
	Warn Severity = "warn"
	// Alert level severity
	Alert Severity = "alert"
	// Critical level severity
	Critical Severity = "critical"
	// Fatal level severity
	Fatal Severity = "fatal"
)

func GetSeverity

func GetSeverity(err error) Severity

GetSeverity returns the severity level of the error

Jump to

Keyboard shortcuts

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