serr

package module
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: MIT Imports: 7 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// ErrLevelFatal constant for fatal error level
	//
	// Deprecated, use ErrorLevelFatal instead!
	ErrLevelFatal = ErrorLevelFatal

	// ErrLevelWarn constant for warning error level
	//
	// Deprecated, use ErrorLevelWarn instead!
	ErrLevelWarn = ErrorLevelWarn

	// ErrLevelInfo constant for info error level
	//
	// Deprecated, use ErrorLevelInfo instead!
	ErrLevelInfo = ErrorLevelInfo

	// ErrKeyNothing constant for empty error key
	//
	// Deprecated, use ErrorKeyNothing instead!
	ErrKeyNothing = ErrorKeyNothing

	// ErrKeyUnexpected constant for unexpected error key
	//
	// Deprecated, use ErrorKeyUnexpected instead!
	ErrKeyUnexpected = ErrorKeyUnexpected

	// ErrKeyExpected constant for expected error key
	//
	// Deprecated, use ErrorKeyExpected instead!
	ErrKeyExpected = ErrorKeyExpected

	// ErrCodeNothing constant for empty error code
	//
	// Deprecated, use ErrorCodeNothing instead!
	ErrCodeNothing = ErrorCodeNothing
)
View Source
const (
	// ErrorKeyNothing constant for empty error key
	ErrorKeyNothing = "-"

	// ErrorKeyUnexpected constant for unexpected error key
	ErrorKeyUnexpected = "unexpected"

	// ErrorKeyExpected constant for expected error key
	ErrorKeyExpected = "expected"

	// ErrorCodeNothing constant for empty error code
	ErrorCodeNothing = 0
)

Variables

This section is empty.

Functions

func RegisterRootPath added in v1.1.5

func RegisterRootPath(paths []string)

RegisterRootPath to registering the root path.

func StandardColorFormat added in v1.1.0

func StandardColorFormat() string

StandardColorFormat function

func StandardFormat added in v1.1.0

func StandardFormat() string

StandardFormat function

Types

type ErrLevel

type ErrLevel = ErrorLevel

ErrLevel type

Deprecated, use ErrorLevel instead!

type ErrPayload

type ErrPayload = ErrorPayload

ErrPayload type

Deprecated, use ErrorPayload instead!

type ErrorLevel added in v1.1.8

type ErrorLevel string

ErrorLevel type

const (
	// ErrorLevelFatal for fatal error
	ErrorLevelFatal ErrorLevel = "fatal"

	// ErrorLevelValidation for validation error
	ErrorLevelValidation ErrorLevel = "warn"

	// ErrorLevelWarn for warning error
	ErrorLevelWarn ErrorLevel = "warn"

	// ErrorLevelInfo for information error
	ErrorLevelInfo ErrorLevel = "info"
)

type ErrorPayload added in v1.1.8

type ErrorPayload map[string]interface{}

ErrorPayload type

type SErr

type SErr interface {
	Error() string
	Cause() error

	Level() ErrorLevel
	Code() int
	Key() string
	Title() string
	Comments() string
	CommentStack() []string
	Payload() ErrorPayload

	Callers() []uintptr
	StackFrames() []gerr.StackFrame

	Type() string
	File() string
	Line() int
	FN() string
	Package() string

	String() string
	ColoredString() string
	SimpleString() string

	SetKey(key string)
	SetCode(code int)
	SetLevel(lvl ErrorLevel)
	AddComment(msg string)
	AddComments(skip int, msg string)
	AddCommentf(msg string, opts ...interface{})
	ApplyPayload(payload ErrorPayload)
	SetPayload(key string, value interface{})
}

SErr interface

func New

func New(message string) SErr

New serr

func NewFromError

func NewFromError(err error) SErr

NewFromError serr from error

func NewFromErrorc

func NewFromErrorc(err error, title string) SErr

NewFromErrorc serr from error and title

func NewFromErrori

func NewFromErrori(code int, err error) SErr

NewFromErrori serr from error and error code

func NewFromErrork

func NewFromErrork(key string, err error) SErr

NewFromErrork serr from error and error key

func NewFromErrorkc added in v1.1.7

func NewFromErrorkc(err error, key string, title string) SErr

NewFromErrorkc serr from error, error key, and title

func NewFromErrorl

func NewFromErrorl(level ErrorLevel, err error) SErr

NewFromErrorl serr from error and error level

func NewFromErrors added in v1.1.0

func NewFromErrors(callerSkip int, err error) SErr

NewFromErrors serr from error and stack callerSkip

func Newc

func Newc(message string, title string) SErr

Newc serr from title

func Newf

func Newf(format string, args ...interface{}) SErr

Newf serr with message binding

func Newi

func Newi(code int, message string) SErr

Newi serr from error code

func Newif

func Newif(code int, frmt string, args ...interface{}) SErr

Newif serr from error code with message binding

func Newik

func Newik(code int, key string, message string) SErr

Newik serr from error code and error key

func Newikc added in v1.1.0

func Newikc(code int, key string, message string, title string) SErr

Newikc serr from error code, error key and title

func Newk

func Newk(key string, message string) SErr

Newk serr from error key

func Newkc

func Newkc(key string, message string, title string) SErr

Newkc serr from error key and title

func Newkf

func Newkf(key string, frmt string, args ...interface{}) SErr

Newkf serr from error key with message binding

func Newl

func Newl(level ErrorLevel, message string) SErr

Newl serr from error level

func Newlc

func Newlc(level ErrorLevel, message string, title string) SErr

Newlc serr from error level and title

func Newlf

func Newlf(level ErrorLevel, message string, args ...interface{}) SErr

Newlf serr from error level with message binding

func Newli

func Newli(level ErrorLevel, code int, message string) SErr

Newli serr from error level and error code

func Newlic added in v1.1.0

func Newlic(level ErrorLevel, code int, message string, title string) SErr

Newlic serr from error level, error code and title

func Newlik added in v1.1.0

func Newlik(level ErrorLevel, code int, key string, message string) SErr

Newlik serr from error level, error code and error key

func Newlikc added in v1.1.0

func Newlikc(level ErrorLevel, code int, key string, message string, title string) SErr

Newlikc serr from error level, error code, error key and title

func Newlk

func Newlk(level ErrorLevel, key string, message string) SErr

Newlk serr from error level and error key

func Newlkc added in v1.1.0

func Newlkc(level ErrorLevel, key string, message string, title string) SErr

Newlkc serr from error level, error key and title

func News added in v1.1.0

func News(callerSkip int, message string) SErr

News serr from stack callerSkip

func Newsc added in v1.1.0

func Newsc(callerSkip int, message string, title string) SErr

Newsc serr from stack callerSkip and title

func Newsf added in v1.1.0

func Newsf(callerSkip int, message string, args ...interface{}) SErr

Newsf serr from stack callerSkip with message binding

func Newsi added in v1.1.0

func Newsi(callerSkip int, code int, message string) SErr

Newsi serr from stack callerSkip and error code

func Newsic added in v1.1.0

func Newsic(callerSkip int, code int, message string, title string) SErr

Newsic serr from stack callerSkip, error code and title

func Newsik added in v1.1.0

func Newsik(callerSkip int, code int, key string, message string) SErr

Newsik serr from stack callerSkip, error code and error key

func Newsikc added in v1.1.0

func Newsikc(callerSkip int, code int, key string, message string, title string) SErr

Newsikc serr from stack callerSkip, error code, error key and title

func Newsk added in v1.1.0

func Newsk(callerSkip int, key string, message string) SErr

Newsk serr from stack callerSkip and error key

func Newskc added in v1.1.0

func Newskc(callerSkip int, key string, message string, title string) SErr

Newskc serr from stack callerSkip, error key and title

func Newsl added in v1.1.0

func Newsl(callerSkip int, level ErrorLevel, message string) SErr

Newsl serr from stack callerSkip and error level

func Newslc added in v1.1.0

func Newslc(callerSkip int, level ErrorLevel, message string, title string) SErr

Newslc serr from stack callerSkip, error level and title

func Newsli added in v1.1.0

func Newsli(callerSkip int, level ErrorLevel, code int, message string) SErr

Newsli serr from stack callerSkip, error level and error code

func Newslic added in v1.1.0

func Newslic(callerSkip int, level ErrorLevel, code int, message string, title string) SErr

Newslic serr from stack callerSkip, error level, error code and title

func Newslik added in v1.1.0

func Newslik(callerSkip int, level ErrorLevel, code int, key string, message string) SErr

Newslik serr from stack callerSkip, error level, error code and error key

func Newslikc added in v1.1.0

func Newslikc(callerSkip int, level ErrorLevel, code int, key string, message string, title string) SErr

Newslikc serr from stack callerSkip, error level, error code, error key and title

func Newslk added in v1.1.0

func Newslk(callerSkip int, level ErrorLevel, key string, message string) SErr

Newslk serr from stack callerSkip, error level and error key

func RegisterHereAsRootPath added in v1.1.8

func RegisterHereAsRootPath(callerSkip int, pathSkip int) SErr

RegisterHereAsRootPath to registering here (current file path) as a root path.

func RegisterThisAsRoot added in v1.1.5

func RegisterThisAsRoot(callerSkip int, pathSkip int) SErr

RegisterThisAsRoot to registering here (current file path) as a root path.

Deprecated, use RegisterHereAsRootPath instead!

type SErrs

type SErrs []SErr

SErrs type mutiple standard error

func (*SErrs) CaptureSErr

func (ox *SErrs) CaptureSErr(errx SErr)

CaptureSErr to capture standard error

func (*SErrs) SimpleString added in v1.1.8

func (ox *SErrs) SimpleString() string

func (*SErrs) String added in v1.1.8

func (ox *SErrs) String() string

Jump to

Keyboard shortcuts

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