errorlib

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetError

func GetError(err error) error

returns the underlying error if available

func GetErrorCode

func GetErrorCode(err error) int

return the errorcode of the error

func WithoutStackTrace

func WithoutStackTrace(err error) error

WithoutStackTrace removes the stacktrace from the error

Types

type ErrorStruct

type ErrorStruct struct {
	Err error

	Code int
	Data interface{}
	// contains filtered or unexported fields
}

func Err

func Err(text string) ErrorStruct

Err creates an error consisting of a simple text

func Errf

func Errf(format string, v ...interface{}) ErrorStruct

Errf creates an error consisting of a text, formatted like fmt.Sprintf

func WrapError

func WrapError(err error) ErrorStruct

WrapError wraps the error into an ErrorStruct with Stacktrace

func (ErrorStruct) Error

func (e ErrorStruct) Error() string

Prints out the error

func (ErrorStruct) WithData

func (e ErrorStruct) WithData(data interface{}) ErrorStruct

WithData sets the data of the error

func (ErrorStruct) WithErrorCode

func (e ErrorStruct) WithErrorCode(code int) ErrorStruct

WithErrorCode sets the errorcode

Jump to

Keyboard shortcuts

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