errorwrapper

package module
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2022 License: MIT Imports: 26 Imported by: 47

README

errorwrapper Intro

Errorwrapper package

errorwrapper is wrapper that helps error handling smartly in go.

Git Clone

git clone https://gitlab.com/evatix-go/errorwrapper.git

2FA enabled, for linux

git clone https://[YourGitLabUserName]:[YourGitlabAcessTokenGenerateFromGitlabsTokens]@gitlab.com/evatix-go/errorwrapper.git

Prerequisites
  • Update git to latest 2.29
  • Update or install the latest of Go 1.15.2
  • Either add your ssh key to your gitlab account
  • Or, use your access token to clone it.

Installation

go get gitlab.com/evatix-go/errorwrapper

Go get issue for private package
  • Update git to 2.29
  • Enable go modules. (Windows : go env -w GO111MODULE=on, Unix : export GO111MODULE=on)
  • Add gitlab.com/evatix-go to go env private

To set for Windows:

go env -w GOPRIVATE=[AddExistingOnes;]gitlab.com/evatix-go

To set for Unix:

expoort GOPRIVATE=[AddExistingOnes;]gitlab.com/evatix-go

Why errorwrapper?

It is to avoid the if-else part for checking errors not nil or handle error based if exits.

Training Videos

Examples

Example 1
errtype.OutOfRangeValue.Panic("something wrong", "alim", []int{1, 2})

image

Example 2
errtype.NotSupportInWindows.PanicNoRefs("not support in windows")

image

Example 3
err2 := errnew.Messages.Many(errtype.Conversion, "I am not ready", "Convert failed.")
fmt.Println(1, err2.IsErrorEquals(err2.Error()))
fmt.Println(2, err2.GetTypeVariantStruct().Variant.IsConversion())
fmt.Println(3, err2.GetTypeVariantStruct().Variant.Is(errtype.Conversion))
fmt.Println(4, err2.GetTypeString())
fmt.Println(5, err2.GetTypeWithCodeString())
fmt.Println(6, err2.GetTypeVariantStruct().Variant.Is(errtype.NotSupportInWindows))
fmt.Println(7, err2.FullString())
fmt.Println(8, err2.IsErrorMessage(err2.FullString(), false))
fmt.Println(9, err2.IsErrorMessage(err2.Error().Error(), false))

image

1 true
2 true
3 true
4 Conversion (Code - 69) : Conversion related error, cannot process the request.
5 (Code - #69) : Conversion
6 false
7 [Error (Conversion - #69): Conversion related error, cannot process the request.
"I am not ready, Convert failed."]
8 false
9 true

Example 4
err2 := errnew.Messages.Many(errtype.Conversion, "I am not ready", "Convert failed.")
fmt.Println(1, err2.FullString())
err2.HandleErrorWithRefs("hello", "var", []int{1, 2})

image

1 [Error (Conversion - #69): Conversion related error, cannot process the request.
"I am not ready, Convert failed."]
panic: hello
[Error (Conversion - #69): Conversion related error, cannot process the request.
"I am not ready, Convert failed."] 
Reference { var([]int): [1 2] }
Example 5 : JSON Parsing
err := errnew.Refs(errtype.AnalysisFailed, "varName", []int{1, 20}, ",", "msg1")
collection := errwrappers.New(5)
collection.AddWrapperPtr(&err)
fmt.Println(collection.String())
jsonResult := collection.Json()

errorsCollection := errwrappers.New(1)
jsonResult.Unmarshal(&errorsCollection)

fmt.Println(errorsCollection.String())

Serializing ErrorWrapper

# Error Wrappers - Collection - Length[1]

- [Error (AnalysisFailed - #138): Analysis is failed. Please consult with appropriate personnel to get the solution.
"msg1" Reference(s) {varName([]int) : [1 20]}.]
# Error Wrappers - Collection - Length[1]

- [Error (AnalysisFailed - #138): Analysis is failed. Please consult with appropriate personnel to get the solution.
"msg1" Reference(s) {varName(string) : [1 20]}.]

Process finished with exit code 0

Acknowledgement

Any other packages used

Issues

Notes

Contributors

License

Evatix MIT License

Documentation

Index

Constants

View Source
const (
	MessagesJoiner = constants.Space
)

Variables

View Source
var (
	StaticEmpty    = Empty()
	StaticEmptyPtr = &StaticEmpty
)

Functions

func ErrorMessageToError added in v0.8.0

func ErrorMessageToError(err error, msg string) error

ErrorMessageToError final error is nil if err is nil

func ErrorType added in v0.9.6

func ErrorType(
	basicErrWrapper errcoreinf.BasicErrWrapper,
) errtype.Variation

func ErrorsToError added in v0.9.6

func ErrorsToError(errItems ...error) error

ErrorsToError

nil items will be ignored.

func ErrorsToString added in v0.8.0

func ErrorsToString(errItems ...error) string

ErrorsToString

nil items will be ignored.

func ErrorsToStringUsingJoiner added in v0.8.0

func ErrorsToStringUsingJoiner(
	joiner string,
	errItems ...error,
) string

ErrorsToStringUsingJoiner nil items will be ignored.

func MessagesJoined added in v0.7.8

func MessagesJoined(messages ...string) string

func SimpleReferencesCompile added in v0.7.0

func SimpleReferencesCompile(
	errType errtype.Variation,
	references ...interface{},
) string

func SimpleReferencesCompileOptimized added in v0.7.0

func SimpleReferencesCompileOptimized(
	errType errtype.Variation,
	references ...interface{},
) string

SimpleReferencesCompileOptimized

errconsts.SimpleReferenceCompileOptimizedFormat = `%typeName (..., "reference")`

Types

type BasicErrWrapper added in v0.9.6

type BasicErrWrapper interface {
	errcoreinf.BasicErrWrapper

	StackTraceString() string
	AsErrorWrapper() *Wrapper
	IsNoError() bool

	coreinterface.Stringer
}

type Cloner added in v0.9.6

type Cloner interface {
	Clone() Wrapper
	ClonePtr() *Wrapper
}

type ConcatNew added in v0.8.9

type ConcatNew struct {
	// contains filtered or unexported fields
}

func (ConcatNew) AsConcatenateNewer added in v0.8.9

func (it ConcatNew) AsConcatenateNewer() ConcatenateNewer

func (ConcatNew) BasicError added in v0.9.6

func (it ConcatNew) BasicError(
	basicErr errcoreinf.BasicErrWrapper,
) *Wrapper

func (ConcatNew) BasicErrorUsingStackSkip added in v0.9.6

func (it ConcatNew) BasicErrorUsingStackSkip(
	stackSkip int,
	basicErr errcoreinf.BasicErrWrapper,
) *Wrapper

func (ConcatNew) CloneStackSkip added in v0.8.9

func (it ConcatNew) CloneStackSkip(
	skipStackIndex int,
) *Wrapper

func (ConcatNew) Error added in v0.8.9

func (it ConcatNew) Error(
	err error,
) *Wrapper

Error

It will create new errorwrapper.Wrapper and combined error with consts.DefaultErrorLineSeparator

func (ConcatNew) ErrorInterface added in v0.9.6

func (it ConcatNew) ErrorInterface(
	errInf errcoreinf.BaseErrorOrCollectionWrapper,
) *Wrapper

func (ConcatNew) ErrorInterfaceUsingStackSkip added in v0.9.6

func (it ConcatNew) ErrorInterfaceUsingStackSkip(
	stackSkip int,
	errInf errcoreinf.BaseErrorOrCollectionWrapper,
) *Wrapper

func (ConcatNew) ErrorUsingStackSkip added in v0.8.9

func (it ConcatNew) ErrorUsingStackSkip(
	skipStackIndex int,
	err error,
) *Wrapper

ErrorUsingStackSkip

It will create new errorwrapper.Wrapper and combined error with consts.DefaultErrorLineSeparator

func (ConcatNew) Errors added in v0.8.9

func (it ConcatNew) Errors(
	errItems ...error,
) *Wrapper

Errors

It will create new errorwrapper.Wrapper and combined errors with consts.DefaultErrorLineSeparator

func (ConcatNew) ErrorsUsingStackSkip added in v0.8.9

func (it ConcatNew) ErrorsUsingStackSkip(
	skipStackIndex int,
	errItems ...error,
) *Wrapper

ErrorsUsingStackSkip

It will create new errorwrapper.Wrapper and combined errors with consts.DefaultErrorLineSeparator

func (ConcatNew) InfoRef added in v1.0.5

func (it ConcatNew) InfoRef(
	info *coretaskinfo.Info,
) *Wrapper

func (ConcatNew) InfoRefWithPayloads added in v1.0.5

func (it ConcatNew) InfoRefWithPayloads(
	info *coretaskinfo.Info,
	payloads []byte,
) *Wrapper

func (ConcatNew) InfoRefWithPayloadsAny added in v1.0.5

func (it ConcatNew) InfoRefWithPayloadsAny(
	info *coretaskinfo.Info,
	payloadsAny interface{},
) *Wrapper

func (ConcatNew) InfoWithRefs added in v1.0.5

func (it ConcatNew) InfoWithRefs(
	info *coretaskinfo.Info,
	references ...ref.Value,
) *Wrapper

func (ConcatNew) Message added in v0.9.6

func (it ConcatNew) Message(
	appendingMessage string,
) *Wrapper

Message

It will create new errorwrapper.Wrapper and combined msg with consts.DefaultErrorLineSeparator

func (ConcatNew) Messages added in v0.8.9

func (it ConcatNew) Messages(
	errMessages ...string,
) *Wrapper

Messages

It will create new errorwrapper.Wrapper and combined msg with consts.DefaultErrorLineSeparator

func (ConcatNew) MessagesUsingStackSkip added in v0.8.9

func (it ConcatNew) MessagesUsingStackSkip(
	skipStackIndex int,
	errMessages ...string,
) *Wrapper

MessagesUsingStackSkip

It will create new errorwrapper.Wrapper and combined msg with consts.DefaultErrorLineSeparator

func (ConcatNew) Msg added in v0.8.9

func (it ConcatNew) Msg(
	errMsg string,
) *Wrapper

Msg

It will create new errorwrapper.Wrapper and combined msg with consts.DefaultErrorLineSeparator

func (ConcatNew) MsgRefOne added in v0.9.6

func (it ConcatNew) MsgRefOne(
	skipStackIndex int,
	errMsg string,
	variableName string, valueAny interface{},
) *Wrapper

func (ConcatNew) MsgRefTwo added in v0.9.6

func (it ConcatNew) MsgRefTwo(
	skipStackIndex int,
	errMsg string,
	firstVariable string, firstValue interface{},
	secondVariable string, secondValue interface{},
) *Wrapper

func (ConcatNew) MsgRefs added in v0.8.9

func (it ConcatNew) MsgRefs(
	skipStackIndex int,
	errMsg string,
	references ...ref.Value,
) *Wrapper

func (ConcatNew) MsgRefsOnly added in v0.8.9

func (it ConcatNew) MsgRefsOnly(
	references ...ref.Value,
) *Wrapper

func (ConcatNew) MsgUsingStackSkip added in v0.8.9

func (it ConcatNew) MsgUsingStackSkip(
	skipStackIndex int,
	errMsg string,
) *Wrapper

MsgUsingStackSkip

It will create new errorwrapper.Wrapper and combined msg with consts.DefaultErrorLineSeparator

func (ConcatNew) NewStackSkip added in v0.9.6

func (it ConcatNew) NewStackSkip(stackSkip int) *Wrapper

func (ConcatNew) NewStackTraces added in v0.8.9

func (it ConcatNew) NewStackTraces(
	stackTraces ...codestack.Trace,
) *Wrapper

func (ConcatNew) PayloadsAny added in v1.1.2

func (it ConcatNew) PayloadsAny(
	payloadsAny interface{},
) *Wrapper

func (ConcatNew) RefsMap added in v1.0.5

func (it ConcatNew) RefsMap(
	references map[string]string,
) *Wrapper

func (ConcatNew) Wrapper added in v0.8.9

func (it ConcatNew) Wrapper(
	another *Wrapper,
) *Wrapper

Wrapper

Warning : It will not take anything other than error message to combine with.

func (ConcatNew) WrapperUsingStackSkip added in v0.8.9

func (it ConcatNew) WrapperUsingStackSkip(
	skipStackIndex int,
	right *Wrapper,
) *Wrapper

WrapperUsingStackSkip

Warning : It will not take anything other than error message to combine with.

type ConcatNewGetter added in v0.9.6

type ConcatNewGetter interface {
	ConcatNew() ConcatNew
}

type ConcatenateNewer added in v0.8.9

type ConcatenateNewer interface {
	NewStackSkip(stackSkip int) *Wrapper
	Error(err error) *Wrapper
	ErrorUsingStackSkip(skipStackIndex int, err error) *Wrapper

	Msg(errMsg string) *Wrapper
	MsgUsingStackSkip(skipStackIndex int, errMsg string) *Wrapper
	MessagesUsingStackSkip(skipStackIndex int, errMessages ...string) *Wrapper

	MsgRefs(
		skipStackIndex int,
		errMsg string,
		references ...ref.Value,
	) *Wrapper
	MsgRefsOnly(
		references ...ref.Value,
	) *Wrapper

	Errors(
		errItems ...error,
	) *Wrapper
	ErrorsUsingStackSkip(skipStackIndex int, errItems ...error) *Wrapper
	Wrapper(another *Wrapper) *Wrapper
	WrapperUsingStackSkip(skipStackIndex int, another *Wrapper) *Wrapper

	ErrorInterface(errInf errcoreinf.BaseErrorOrCollectionWrapper) *Wrapper
	ErrorInterfaceUsingStackSkip(
		stackSkip int,
		errInf errcoreinf.BaseErrorOrCollectionWrapper,
	) *Wrapper

	BasicError(
		basicErr errcoreinf.BasicErrWrapper,
	) *Wrapper
	BasicErrorUsingStackSkip(
		stackSkip int,
		basicErr errcoreinf.BasicErrWrapper,
	) *Wrapper

	NewStackTraces(
		stackTraces ...codestack.Trace,
	) *Wrapper
	CloneStackSkip(
		skipStackIndex int,
	) *Wrapper
}

type ContractsFriendlyErrorWrapper added in v1.0.3

type ContractsFriendlyErrorWrapper interface {
	ErrWrapper
	ErrWrapGetter
	SetLogType(variant logtype.Variant) ContractsFriendlyErrorWrapper
	SetTaskInfo(info *coretaskinfo.Info) ContractsFriendlyErrorWrapper
	TaskInfo() *coretaskinfo.Info
	InfoFieldsMap() map[string]string
	SetPayload(
		payloads []byte,
	)
	SetPayloadString(
		payloadStr string,
	) []byte
	PayloadString() string
	RawPayloads() []byte
	FriendlyMsg() string
	IsEmptyFriendlyMessage() bool
	IsFriendlyMessageContains(contains string) bool
	JsonModelAny() interface{}
	HasPayload() bool
	IsPayloadEmpty() bool
	PayloadDeserialize(toPtr interface{}) *Wrapper
	PayloadDeserializeToPayloadWrapper() (payloadWrapper *corepayload.PayloadWrapper, compiledErr *Wrapper)
}

type ErrWrapGetter added in v1.0.3

type ErrWrapGetter interface {
	ErrWrap() *Wrapper
}

type ErrWrapper added in v0.9.6

type ErrWrapper interface {
	BasicErrWrapper

	ErrWrapGetter

	TypeOfErrorWrapperGetter
	// MustBeEmptyError
	//
	//  Panics if error exist
	MustBeEmptyError

	References() *refs.Collection
	MergeNewReferences(additionalReferences ...ref.Value) *refs.Collection
	IsTypeOf(errType errtype.Variation) bool
	ReflectSetToErrorWrapper
	ReflectSetToErrWrap(toPtr interface{}) *Wrapper

	corejson.JsonContractsBinder
}

type ErrWrapperContractsBinder added in v0.9.6

type ErrWrapperContractsBinder interface {
	ErrWrapper
	AsErrWrapperContractsBinder() ErrWrapperContractsBinder
}

type ErrorStringer added in v0.9.6

type ErrorStringer interface {
	ErrorString() string
}

type ErrorTypeStringer added in v0.9.6

type ErrorTypeStringer interface {
	TypeCodeNameString() string
	TypeNameCode() string
	TypeString() string
}

type FriendlyError added in v1.0.3

type FriendlyError struct {
	FriendlyErrorMessage string
	LogType              logtype.Variant
	Info                 *coretaskinfo.Info
	Payloads             []byte
	ErrorWrapper         *Wrapper
}

func (FriendlyError) AsContractsFriendlyErrorWrapper added in v1.0.3

func (it FriendlyError) AsContractsFriendlyErrorWrapper() FriendlyErrorWrapperContractsBinder

func (FriendlyError) AsErrorWrapper added in v1.0.3

func (it FriendlyError) AsErrorWrapper() *Wrapper

func (FriendlyError) AsJsonContractsBinder added in v1.0.3

func (it FriendlyError) AsJsonContractsBinder() corejson.JsonContractsBinder

func (FriendlyError) Clone added in v1.0.3

func (it FriendlyError) Clone() FriendlyError

func (*FriendlyError) CloneInterface added in v1.0.3

func (it *FriendlyError) CloneInterface() errcoreinf.BasicErrWrapper

func (FriendlyError) CloneNewStackSkipPtr added in v1.0.3

func (it FriendlyError) CloneNewStackSkipPtr(stackSkip int) *Wrapper

func (*FriendlyError) ClonePtr added in v1.0.3

func (it *FriendlyError) ClonePtr() *FriendlyError

func (*FriendlyError) CloneReferences added in v1.0.3

func (it *FriendlyError) CloneReferences() *refs.Collection

func (*FriendlyError) CodeTypeName added in v1.0.3

func (it *FriendlyError) CodeTypeName() string

func (*FriendlyError) Compile added in v1.0.3

func (it *FriendlyError) Compile() string

Compile

Refers to the FullString

func (*FriendlyError) CompileString added in v1.0.3

func (it *FriendlyError) CompileString() string

CompileString

Refers to the FullString

func (*FriendlyError) CompiledError added in v1.0.3

func (it *FriendlyError) CompiledError() error

func (*FriendlyError) CompiledErrorWithStackTraces added in v1.0.3

func (it *FriendlyError) CompiledErrorWithStackTraces() error

func (*FriendlyError) CompiledJsonErrorWithStackTraces added in v1.0.3

func (it *FriendlyError) CompiledJsonErrorWithStackTraces() error

func (*FriendlyError) CompiledJsonStringWithStackTraces added in v1.0.3

func (it *FriendlyError) CompiledJsonStringWithStackTraces() (jsonString string)

func (*FriendlyError) CompiledStackTracesString added in v1.0.3

func (it *FriendlyError) CompiledStackTracesString() string

func (*FriendlyError) ConcatNew added in v1.0.3

func (it *FriendlyError) ConcatNew() ConcatNew

ConcatNew

It is safe to use for nil.

func (*FriendlyError) Dispose added in v1.0.3

func (it *FriendlyError) Dispose()

func (*FriendlyError) ErrWrap added in v1.0.3

func (it *FriendlyError) ErrWrap() *Wrapper

func (*FriendlyError) Error added in v1.0.3

func (it *FriendlyError) Error() error

func (*FriendlyError) ErrorString added in v1.0.3

func (it *FriendlyError) ErrorString() string

ErrorString if empty error then returns ""

func (*FriendlyError) ErrorTypeAsBasicErrorTyper added in v1.0.3

func (it *FriendlyError) ErrorTypeAsBasicErrorTyper() errcoreinf.BasicErrorTyper

func (*FriendlyError) FriendlyMsg added in v1.0.3

func (it *FriendlyError) FriendlyMsg() string

func (*FriendlyError) FullOrErrorMessage added in v1.0.3

func (it *FriendlyError) FullOrErrorMessage(
	isErrorMessage,
	isWithRef bool,
) string

func (*FriendlyError) FullString added in v1.0.3

func (it *FriendlyError) FullString() string

func (*FriendlyError) FullStringSplitByNewLine added in v1.0.3

func (it *FriendlyError) FullStringSplitByNewLine() []string

func (*FriendlyError) FullStringWithLimitTraces added in v1.0.3

func (it *FriendlyError) FullStringWithLimitTraces(limit int) string

func (*FriendlyError) FullStringWithTraces added in v1.0.3

func (it *FriendlyError) FullStringWithTraces() string

func (*FriendlyError) FullStringWithTracesIf added in v1.0.3

func (it *FriendlyError) FullStringWithTracesIf(
	isStackTraces bool,
) string

func (*FriendlyError) FullStringWithoutReferences added in v1.0.3

func (it *FriendlyError) FullStringWithoutReferences() string

func (*FriendlyError) GetAsBasicWrapper added in v1.0.3

func (it *FriendlyError) GetAsBasicWrapper() errcoreinf.BasicErrWrapper

func (*FriendlyError) GetAsBasicWrapperUsingTyper added in v1.0.3

func (it *FriendlyError) GetAsBasicWrapperUsingTyper(
	errorTyper errcoreinf.BasicErrorTyper,
) errcoreinf.BasicErrWrapper

func (*FriendlyError) GetTypeVariantStruct added in v1.0.3

func (it *FriendlyError) GetTypeVariantStruct() errtype.VariantStructure

func (*FriendlyError) HandleError added in v1.0.3

func (it *FriendlyError) HandleError()

HandleError

Only call panic if Wrapper has currentError

func (*FriendlyError) HandleErrorWithMsg added in v1.0.3

func (it *FriendlyError) HandleErrorWithMsg(
	newMessage string,
)

HandleErrorWithMsg Only call panic if has currentError

func (*FriendlyError) HandleErrorWithRefs added in v1.0.3

func (it *FriendlyError) HandleErrorWithRefs(
	newMessage string,
	refVar,
	refVal interface{},
)

func (*FriendlyError) HasAnyError added in v1.0.3

func (it *FriendlyError) HasAnyError() bool

func (*FriendlyError) HasAnyIssues added in v1.0.3

func (it *FriendlyError) HasAnyIssues() bool

func (*FriendlyError) HasCurrentError added in v1.0.3

func (it *FriendlyError) HasCurrentError() bool

HasCurrentError

Refers to Wrapper error embedded or not.

Best to use HasError

func (*FriendlyError) HasError added in v1.0.3

func (it *FriendlyError) HasError() bool

HasError

Returns true if not empty. Invert of IsEmpty()

Conditions (true):

  • if Wrapper is NOT nil, Or,
  • if Wrapper is NOT StaticEmptyPtr, Or,
  • if Wrapper .errorType is NOT IsNoError(), Or,
  • if Wrapper .currentError is nil and Wrapper .references.IsEmpty()

func (*FriendlyError) HasPayload added in v1.0.3

func (it *FriendlyError) HasPayload() bool

func (*FriendlyError) HasReferences added in v1.0.3

func (it *FriendlyError) HasReferences() bool

func (*FriendlyError) InfoFieldsMap added in v1.0.3

func (it *FriendlyError) InfoFieldsMap() map[string]string

func (*FriendlyError) IsAnyNull added in v1.0.3

func (it *FriendlyError) IsAnyNull() bool

func (*FriendlyError) IsBasicErrEqual added in v1.0.3

func (it *FriendlyError) IsBasicErrEqual(
	another errcoreinf.BasicErrWrapper,
) bool

func (*FriendlyError) IsCollect added in v1.0.3

func (it *FriendlyError) IsCollect(
	another errcoreinf.BaseErrorOrCollectionWrapper,
) bool

IsCollect

ConcatNew() recommend to use instead.

Warning :

mutates current error, recommended NOT use,
it is for the commonalities between error Wrapper and collection

func (*FriendlyError) IsCollectOn added in v1.0.3

func (it *FriendlyError) IsCollectOn(
	isCollect bool,
	another errcoreinf.BaseErrorOrCollectionWrapper,
) bool

IsCollectOn

ConcatNew() recommend to use instead.

Warning :

mutates current error, recommended NOT use,
it is for the commonalities between error Wrapper and collection

func (*FriendlyError) IsCollectedAny added in v1.0.3

func (it *FriendlyError) IsCollectedAny(
	anotherItems ...errcoreinf.BaseErrorOrCollectionWrapper,
) bool

IsCollectedAny

ConcatNew() recommend to use instead.

Warning :

mutates current error, recommended NOT use,
it is for the commonalities between error Wrapper and collection

func (*FriendlyError) IsCollectionType added in v1.0.3

func (it *FriendlyError) IsCollectionType() bool

func (*FriendlyError) IsDefined added in v1.0.3

func (it *FriendlyError) IsDefined() bool

func (*FriendlyError) IsEmpty added in v1.0.3

func (it *FriendlyError) IsEmpty() bool

IsEmpty

Refers to no error for print or doesn't treat this as error.

Conditions (true):

  • if Wrapper nil, Or,
  • if Wrapper is StaticEmptyPtr, Or,
  • if Wrapper .errorType is IsNoError(), Or,
  • if Wrapper .currentError NOT nil and Wrapper .references.IsEmpty()

func (*FriendlyError) IsEmptyAll added in v1.0.3

func (it *FriendlyError) IsEmptyAll(
	anotherItems ...errcoreinf.BaseErrorOrCollectionWrapper,
) bool

func (*FriendlyError) IsEmptyError added in v1.0.3

func (it *FriendlyError) IsEmptyError() bool

func (*FriendlyError) IsEmptyFriendlyMessage added in v1.0.3

func (it *FriendlyError) IsEmptyFriendlyMessage() bool

func (*FriendlyError) IsEquals added in v1.0.3

func (it *FriendlyError) IsEquals(right *Wrapper) bool

func (*FriendlyError) IsErrorEquals added in v1.0.3

func (it *FriendlyError) IsErrorEquals(err error) bool

func (*FriendlyError) IsErrorMessage added in v1.0.3

func (it *FriendlyError) IsErrorMessage(msg string, isCaseSensitive bool) bool

IsErrorMessage

If error IsEmpty then returns false regardless

func (*FriendlyError) IsErrorMessageContains added in v1.0.3

func (it *FriendlyError) IsErrorMessageContains(
	msg string,
	isCaseSensitive bool,
) bool

IsErrorMessageContains If error IsEmpty then returns false regardless

func (*FriendlyError) IsErrorMessageEqual added in v1.0.3

func (it *FriendlyError) IsErrorMessageEqual(msg string) bool

func (*FriendlyError) IsFailed added in v1.0.3

func (it *FriendlyError) IsFailed() bool

func (FriendlyError) IsFriendlyMessageContains added in v1.0.3

func (it FriendlyError) IsFriendlyMessageContains(
	contains string,
) bool

func (*FriendlyError) IsInvalid added in v1.0.3

func (it *FriendlyError) IsInvalid() bool

func (*FriendlyError) IsNoError added in v1.0.3

func (it *FriendlyError) IsNoError() bool

func (*FriendlyError) IsNotEquals added in v1.0.3

func (it *FriendlyError) IsNotEquals(right *Wrapper) bool

func (*FriendlyError) IsNull added in v1.0.3

func (it *FriendlyError) IsNull() bool

func (*FriendlyError) IsPayloadEmpty added in v1.0.3

func (it *FriendlyError) IsPayloadEmpty() bool

func (*FriendlyError) IsReferencesEmpty added in v1.0.3

func (it *FriendlyError) IsReferencesEmpty() bool

func (*FriendlyError) IsSuccess added in v1.0.3

func (it *FriendlyError) IsSuccess() bool

func (*FriendlyError) IsTypeOf added in v1.0.3

func (it *FriendlyError) IsTypeOf(errType errtype.Variation) bool

func (*FriendlyError) IsValid added in v1.0.3

func (it *FriendlyError) IsValid() bool

func (FriendlyError) Json added in v1.0.3

func (it FriendlyError) Json() corejson.Result

func (FriendlyError) JsonModel added in v1.0.3

func (it FriendlyError) JsonModel() WrapperDataModel

func (FriendlyError) JsonModelAny added in v1.0.3

func (it FriendlyError) JsonModelAny() interface{}

func (*FriendlyError) JsonParseSelfInject added in v1.0.3

func (it *FriendlyError) JsonParseSelfInject(
	jsonResult *corejson.Result,
) error

func (FriendlyError) JsonPtr added in v1.0.3

func (it FriendlyError) JsonPtr() *corejson.Result

func (FriendlyError) JsonResultWithoutTraces added in v1.0.3

func (it FriendlyError) JsonResultWithoutTraces() *corejson.Result

func (*FriendlyError) Log added in v1.0.3

func (it *FriendlyError) Log()

func (*FriendlyError) LogFatal added in v1.0.3

func (it *FriendlyError) LogFatal()

func (*FriendlyError) LogFatalWithTraces added in v1.0.3

func (it *FriendlyError) LogFatalWithTraces()

func (*FriendlyError) LogIf added in v1.0.3

func (it *FriendlyError) LogIf(isLog bool)

func (*FriendlyError) LogWithTraces added in v1.0.3

func (it *FriendlyError) LogWithTraces()

func (*FriendlyError) MarshalJSON added in v1.0.3

func (it *FriendlyError) MarshalJSON() ([]byte, error)

func (*FriendlyError) MergeNewErrInf added in v1.0.3

func (*FriendlyError) MergeNewMessage added in v1.0.3

func (it *FriendlyError) MergeNewMessage(
	newMessage string,
) errcoreinf.BaseErrorOrCollectionWrapper

func (*FriendlyError) MergeNewReferences added in v1.0.3

func (it *FriendlyError) MergeNewReferences(
	additionalReferences ...ref.Value,
) *refs.Collection

func (*FriendlyError) MustBeEmpty added in v1.0.3

func (it *FriendlyError) MustBeEmpty()

func (*FriendlyError) MustBeEmptyError added in v1.0.3

func (it *FriendlyError) MustBeEmptyError()

func (*FriendlyError) MustBeSafe added in v1.0.3

func (it *FriendlyError) MustBeSafe()

func (*FriendlyError) NewDefaultStackTraces added in v1.0.3

func (it *FriendlyError) NewDefaultStackTraces() string

func (*FriendlyError) NewDefaultStackTracesJsonResult added in v1.0.3

func (it *FriendlyError) NewDefaultStackTracesJsonResult() *corejson.Result

func (*FriendlyError) NewStackTraces added in v1.0.3

func (it *FriendlyError) NewStackTraces(
	stackSkip int,
) string

func (*FriendlyError) NewStackTracesJsonResult added in v1.0.3

func (it *FriendlyError) NewStackTracesJsonResult(
	stackSkip int,
) *corejson.Result

func (FriendlyError) NonPtr added in v1.0.3

func (it FriendlyError) NonPtr() FriendlyError

func (*FriendlyError) ParseInjectUsingJson added in v1.0.3

func (it *FriendlyError) ParseInjectUsingJson(
	jsonResult *corejson.Result,
) (*FriendlyError, error)

func (*FriendlyError) ParseInjectUsingJsonMust added in v1.0.3

func (it *FriendlyError) ParseInjectUsingJsonMust(
	jsonResult *corejson.Result,
) *FriendlyError

ParseInjectUsingJsonMust Panic if error

func (FriendlyError) PayloadDeserialize added in v1.0.3

func (it FriendlyError) PayloadDeserialize(
	toPtr interface{},
) *Wrapper

func (FriendlyError) PayloadDeserializeToPayloadWrapper added in v1.0.3

func (it FriendlyError) PayloadDeserializeToPayloadWrapper() (
	payloadWrapper *corepayload.PayloadWrapper, compiledErr *Wrapper,
)

func (*FriendlyError) PayloadString added in v1.0.3

func (it *FriendlyError) PayloadString() string

func (FriendlyError) Ptr added in v1.0.3

func (it FriendlyError) Ptr() *FriendlyError

func (*FriendlyError) RawErrorTypeName added in v1.0.3

func (it *FriendlyError) RawErrorTypeName() string

func (*FriendlyError) RawErrorTypeValue added in v1.0.3

func (it *FriendlyError) RawErrorTypeValue() uint16

func (*FriendlyError) RawPayloads added in v1.0.3

func (it *FriendlyError) RawPayloads() []byte

func (*FriendlyError) References added in v1.0.3

func (it *FriendlyError) References() *refs.Collection

func (FriendlyError) ReferencesCollection added in v1.0.3

func (it FriendlyError) ReferencesCollection() errcoreinf.ReferenceCollectionDefiner

func (*FriendlyError) ReferencesCompiledString added in v1.0.3

func (it *FriendlyError) ReferencesCompiledString() string

func (*FriendlyError) ReferencesList added in v1.0.3

func (it *FriendlyError) ReferencesList() []errcoreinf.Referencer

func (*FriendlyError) ReflectSetTo added in v1.0.3

func (it *FriendlyError) ReflectSetTo(toPtr interface{}) error

ReflectSetTo

Set any object from to toPointer object

Valid Inputs or Supported (https://t.ly/1Lpt):

  • From, To: (null, null) -- do nothing
  • From, To: (sameTypePointer, sameTypePointer) -- try reflection
  • From, To: (sameTypeNonPointer, sameTypePointer) -- try reflection
  • From, To: ([]byte or *[]byte, otherType) -- try unmarshal, reflect
  • From, To: (otherType, *[]byte) -- try marshal, reflect

Validations:

  • Check null, if both null no error return quickly.
  • NotSupported returns as error.
  • NotSupported: (from, to) - (..., not pointer)
  • NotSupported: (from, to) - (null, notNull)
  • NotSupported: (from, to) - (notNull, null)
  • NotSupported: (from, to) - not same type and not bytes on any
  • `From` null or nil is not supported and will return error.

Reference:

func (*FriendlyError) ReflectSetToErrWrap added in v1.0.3

func (it *FriendlyError) ReflectSetToErrWrap(toPtr interface{}) *Wrapper

ReflectSetToErrWrap

Reusing ReflectSetTo

func (*FriendlyError) Serialize added in v1.0.3

func (it *FriendlyError) Serialize() ([]byte, error)

Serialize

Returns json with stack-traces

func (*FriendlyError) SerializeMust added in v1.0.3

func (it *FriendlyError) SerializeMust() []byte

func (*FriendlyError) SerializeWithoutTraces added in v1.0.3

func (it *FriendlyError) SerializeWithoutTraces() ([]byte, error)

func (*FriendlyError) SetLogType added in v1.0.3

func (*FriendlyError) SetPayload added in v1.0.3

func (it *FriendlyError) SetPayload(
	payloads []byte,
)

func (*FriendlyError) SetPayloadString added in v1.0.3

func (it *FriendlyError) SetPayloadString(
	payloadStr string,
) []byte

func (*FriendlyError) SetTaskInfo added in v1.0.3

func (*FriendlyError) StackTraceString added in v1.0.3

func (it *FriendlyError) StackTraceString() string

func (*FriendlyError) StackTraces added in v1.0.3

func (it *FriendlyError) StackTraces() string

func (*FriendlyError) StackTracesJsonResult added in v1.0.3

func (it *FriendlyError) StackTracesJsonResult() *corejson.Result

func (*FriendlyError) StackTracesLimit added in v1.0.3

func (it *FriendlyError) StackTracesLimit(limit int) *codestack.TraceCollection

func (FriendlyError) String added in v1.0.3

func (it FriendlyError) String() string

func (FriendlyError) StringIf added in v1.0.3

func (it FriendlyError) StringIf(isWithRef bool) string

func (*FriendlyError) TaskInfo added in v1.0.3

func (it *FriendlyError) TaskInfo() *coretaskinfo.Info

func (*FriendlyError) Type added in v1.0.3

func (it *FriendlyError) Type() errtype.Variation

func (*FriendlyError) TypeCodeNameString added in v1.0.3

func (it *FriendlyError) TypeCodeNameString() string

TypeCodeNameString

Format : errconsts.ErrorCodeWithTypeNameFormat

"(Code - #%d) : %s"

func (*FriendlyError) TypeName added in v1.0.3

func (it *FriendlyError) TypeName() string

TypeName

Returns error type name,
on empty returns empty string.

Example :

  • For errtype.NoError : ""
  • For errtype.Generic : "Generic"

func (*FriendlyError) TypeNameCode added in v1.0.3

func (it *FriendlyError) TypeNameCode() string

TypeNameCode

Returns error type Code number value with name,
on empty returns empty string.

Format :

  • "(#%d - %s)"
  • "(#1 - Generic)"

func (*FriendlyError) TypeNameCodeMessage added in v1.0.3

func (it *FriendlyError) TypeNameCodeMessage() string

func (*FriendlyError) TypeNameWithCustomMessage added in v1.0.3

func (it *FriendlyError) TypeNameWithCustomMessage(
	customMessage string,
) string

TypeNameWithCustomMessage

errconsts.ErrorCodeHyphenTypeNameWithLineFormat = "(#%d - %s) %s"

func (*FriendlyError) TypeString added in v1.0.3

func (it *FriendlyError) TypeString() string

TypeString

Returns whole type string, should be refactored to whole-type string name

Format :
 - errconsts.VariantStructStringFormat
 - "%s (Code - %d) : %s" : "Name (Code - ValueInt) : Message from type string"
 - Exact Example for errtype.Generic : "Generic (Code - 1) : Generic error"

func (*FriendlyError) UnmarshalJSON added in v1.0.3

func (it *FriendlyError) UnmarshalJSON(
	jsonBytes []byte,
) error

func (*FriendlyError) ValidationErrUsingTextValidator added in v1.0.3

func (it *FriendlyError) ValidationErrUsingTextValidator(
	validator *corevalidator.TextValidator,
	params *corevalidator.ValidatorParamsBase,
) *Wrapper

func (*FriendlyError) Value added in v1.0.3

func (it *FriendlyError) Value() error

type FriendlyErrorWrapperContractsBinder added in v1.0.3

type FriendlyErrorWrapperContractsBinder interface {
	ContractsFriendlyErrorWrapper
	AsContractsFriendlyErrorWrapper() FriendlyErrorWrapperContractsBinder
}

type Getter added in v0.9.6

type Getter interface {
	ErrorWrapper() *Wrapper
}

type InterfaceGetter added in v0.9.6

type InterfaceGetter interface {
	ErrorWrapperInf() ErrWrapper
}

type MustBeEmptyError added in v0.9.6

type MustBeEmptyError interface {
	MustBeEmpty()
}

type ReflectSetToErrorWrapper added in v0.9.6

type ReflectSetToErrorWrapper interface {
	// ReflectSetToErrWrap
	//
	// Set any object from to toPointer object
	//
	// Valid Inputs or Supported (https://t.ly/1Lpt):
	//  - From, To: (null, null)                          -- do nothing
	//  - From, To: (sameTypePointer, sameTypePointer)    -- try reflection
	//  - From, To: (sameTypeNonPointer, sameTypePointer) -- try reflection
	//  - From, To: ([]byte or *[]byte, otherType)        -- try unmarshal, reflect
	//  - From, To: (otherType, *[]byte)                  -- try marshal, reflect
	//
	// Validations:
	//  - Check null, if both null no error return quickly.
	//  - NotSupported returns as error.
	//      - NotSupported: (from, to) - (..., not pointer)
	//      - NotSupported: (from, to) - (null, notNull)
	//      - NotSupported: (from, to) - (notNull, null)
	//      - NotSupported: (from, to) - not same type and not bytes on any
	//  - `From` null or nil is not supported and will return error.
	//
	// Reference:
	//  - Reflection String Set Example : https://go.dev/play/p/fySLYuOvoRK.go?download=true
	//  - Method document screenshot    : https://prnt.sc/26dmf5g
	ReflectSetToErrWrap(toPtr interface{}) *Wrapper
}

ReflectSetToErrorWrapper

Set any object from to toPointer object

Valid Inputs or Supported (https://t.ly/1Lpt):

  • From, To: (null, null) -- do nothing
  • From, To: (sameTypePointer, sameTypePointer) -- try reflection
  • From, To: (sameTypeNonPointer, sameTypePointer) -- try reflection
  • From, To: ([]byte or *[]byte, otherType) -- try unmarshal, reflect
  • From, To: (otherType, *[]byte) -- try marshal, reflect

Validations:

  • Check null, if both null no error return quickly.
  • NotSupported returns as error.
  • NotSupported: (from, to) - (..., not pointer)
  • NotSupported: (from, to) - (null, notNull)
  • NotSupported: (from, to) - (notNull, null)
  • NotSupported: (from, to) - not same type and not bytes on any
  • `From` null or nil is not supported and will return error.

Reference:

type ResultsContractsBinder added in v0.9.6

type ResultsContractsBinder interface {
	ValuesWithErrorWrapper
	AsResultsContractsBinder() ResultsContractsBinder
}

type SafeBytesWithErrWrapGetter added in v1.1.5

type SafeBytesWithErrWrapGetter interface {
	ErrWrapGetter
	serializerinf.SafeValuesGetter
}

type SafeBytesWithErrWrapGetterContractsBinder added in v1.1.5

type SafeBytesWithErrWrapGetterContractsBinder interface {
	SafeBytesWithErrWrapGetter
	AsSafeBytesWithErrWrapGetterContractsBinder() SafeBytesWithErrWrapGetterContractsBinder
}

type StringFmtFunc added in v0.7.9

type StringFmtFunc = func(wrapper *Wrapper) string

type TypeOfErrorWrapperGetter added in v0.9.6

type TypeOfErrorWrapperGetter interface {
	Type() errtype.Variation
}

type ValueWithErrorWrapperBinder added in v0.9.6

type ValueWithErrorWrapperBinder interface {
	ValueWithErrorWrapper
	AsValueWithErrorWrapperBinder() ValueWithErrorWrapperBinder
}

type ValuesWithErrorWrapperCollectionBinder added in v0.9.6

type ValuesWithErrorWrapperCollectionBinder interface {
	ValuesWithErrorWrapper
	AsValuesWithErrorWrapperCollectionBinder() ValuesWithErrorWrapperCollectionBinder
}

type Wrapper

type Wrapper struct {
	// contains filtered or unexported fields
}

func CastBasicErrWrapperToWrapper added in v0.9.6

func CastBasicErrWrapperToWrapper(
	basicErrWrapper errcoreinf.BasicErrWrapper,
) *Wrapper

func CastInterfaceToErrorWrapper added in v0.9.6

func CastInterfaceToErrorWrapper(
	errorInterface errcoreinf.BaseErrorOrCollectionWrapper,
) *Wrapper

CastInterfaceToErrorWrapper

  • if empty then returns nil or empty then
  • cast to Wrapper on success returns
  • On fail, usages BaseErrorOrCollectionWrapper.GetAsBasicWrapper() then cast
  • cast to Wrapper on success return if failed

func CastInterfaceToErrorWrapperUsingStackSkip added in v0.9.6

func CastInterfaceToErrorWrapperUsingStackSkip(
	stackStartIndex int,
	errorInterface errcoreinf.BaseErrorOrCollectionWrapper,
) *Wrapper

func Empty added in v0.0.2

func Empty() Wrapper

func EmptyPrint added in v0.0.4

func EmptyPrint() Wrapper

func EmptyPtr added in v0.0.4

func EmptyPtr() *Wrapper

func ErrorsToWrap added in v0.9.6

func ErrorsToWrap(
	errType errtype.Variation,
	errItems ...error,
) *Wrapper

ErrorsToWrap

nil items will be ignored.

func ErrorsToWrapper added in v0.8.0

func ErrorsToWrapper(
	errType errtype.Variation,
	errItems ...error,
) *Wrapper

ErrorsToWrapper nil items will be ignored.

func InterfaceToErrorWrapper added in v0.9.6

func InterfaceToErrorWrapper(
	errType errtype.Variation,
	errorInterface errcoreinf.BaseErrorOrCollectionWrapper,
) *Wrapper

InterfaceToErrorWrapper

first tries to cast to Wrapper if not successful then create new one.

func InterfaceToErrorWrapperUsingStackSkip added in v0.9.6

func InterfaceToErrorWrapperUsingStackSkip(
	stackStartIndex int,
	errType errtype.Variation,
	errorInterface errcoreinf.BaseErrorOrCollectionWrapper,
) *Wrapper

func JsonResultToWrapper added in v0.9.6

func JsonResultToWrapper(
	jsonResult *corejson.Result,
) (*Wrapper, error)

func New

func New(errType errtype.Variation) Wrapper

func NewErrUsingAllParams

func NewErrUsingAllParams(
	stackSkipIndex int,
	errType errtype.Variation,
	isDisplayableError bool,
	err error,
	references *refs.Collection,
) Wrapper

func NewErrUsingAllParamsPtr

func NewErrUsingAllParamsPtr(
	stackSkipIndex int,
	errType errtype.Variation,
	isDisplayableError bool,
	err error,
	references *refs.Collection,
) *Wrapper

func NewError added in v0.1.9

func NewError(
	stackSkipIndex int,
	err error,
) *Wrapper

func NewErrorPlusMsgUsingAllParamsPtr added in v0.0.2

func NewErrorPlusMsgUsingAllParamsPtr(
	stackSkipIndex int,
	errType errtype.Variation,
	isDisplayableError bool,
	err error,
	message string,
	references *refs.Collection,
) *Wrapper

func NewErrorRef1 added in v0.6.5

func NewErrorRef1(
	stackSkipIndex int,
	errType errtype.Variation,
	err error,
	var1 string,
	val1 interface{},
) *Wrapper

NewErrorRef1 alias for NewRef

func NewFromDataModel added in v0.4.0

func NewFromDataModel(
	model *WrapperDataModel,
) *Wrapper

func NewGeneric

func NewGeneric(
	stackSkipIndex int,
	error error,
) *Wrapper

func NewInterfacesToErrorWrappers added in v0.9.6

func NewInterfacesToErrorWrappers(
	errorInterfaces ...errcoreinf.BaseErrorOrCollectionWrapper,
) []*Wrapper

func NewMessagesUsingJoiner added in v0.9.0

func NewMessagesUsingJoiner(
	stackSkipIndex int,
	errType errtype.Variation,
	joiner string,
	messages ...string,
) *Wrapper

func NewMsgDisplayError added in v0.9.0

func NewMsgDisplayError(
	stackSkipIndex int,
	errType errtype.Variation,
	message string,
	references *refs.Collection,
) *Wrapper

func NewMsgDisplayErrorNoReference added in v0.9.0

func NewMsgDisplayErrorNoReference(
	stackSkipIndex int,
	errType errtype.Variation,
	message string,
) *Wrapper

func NewMsgDisplayErrorReferencesPtr added in v0.8.3

func NewMsgDisplayErrorReferencesPtr(
	stackSkipIndex int,
	errType errtype.Variation,
	message string,
	references ...ref.Value,
) *Wrapper

func NewMsgDisplayErrorUsingInfoReference added in v1.1.2

func NewMsgDisplayErrorUsingInfoReference(
	stackSkipIndex int,
	errType errtype.Variation,
	info *coretaskinfo.Info,
	message string,
) *Wrapper

func NewMsgDisplayErrorUsingInfoWithReferences added in v1.1.2

func NewMsgDisplayErrorUsingInfoWithReferences(
	stackSkipIndex int,
	errType errtype.Variation,
	info *coretaskinfo.Info,
	message string,
	references ...ref.Value,
) *Wrapper

func NewMsgDisplayErrorUsingStackTracesPtr added in v0.7.9

func NewMsgDisplayErrorUsingStackTracesPtr(
	errType errtype.Variation,
	message string,
	stackTraces codestack.TraceCollection,
	references ...ref.Value,
) *Wrapper

func NewMsgUsingAllParams

func NewMsgUsingAllParams(
	stackSkipIndex int,
	errType errtype.Variation,
	isDisplayableError bool,
	message string,
	references *refs.Collection,
) *Wrapper

func NewMsgUsingCodeStacksPtr added in v0.7.9

func NewMsgUsingCodeStacksPtr(
	errType errtype.Variation,
	isDisplayableError bool,
	message string,
	codeStacks codestack.TraceCollection,
	references *refs.Collection,
) *Wrapper

func NewOnlyRefs added in v0.5.2

func NewOnlyRefs(
	stackSkipIndex int,
	errType errtype.Variation,
	refValues ...ref.Value,
) *Wrapper

func NewPath added in v0.5.2

func NewPath(
	stackSkipIndex int,
	errType errtype.Variation,
	error error,
	filePath string,
) *Wrapper

func NewPathMessages added in v0.9.2

func NewPathMessages(
	stackSkipIndex int,
	errType errtype.Variation,
	filePath string,
	messages ...string,
) *Wrapper

func NewPathMsg added in v0.9.2

func NewPathMsg(
	stackSkipIndex int,
	errType errtype.Variation,
	message,
	filePath string,
) *Wrapper

func NewPtr added in v0.0.7

func NewPtr(errType errtype.Variation) *Wrapper

func NewPtrUsingStackSkip added in v0.7.9

func NewPtrUsingStackSkip(
	stackStartIndex int,
	errType errtype.Variation,
) *Wrapper

func NewRef added in v0.5.2

func NewRef(
	stackSkipIndex int,
	errType errtype.Variation,
	err error,
	varName string,
	val interface{},
) *Wrapper

func NewRef1Msg added in v0.7.0

func NewRef1Msg(
	stackSkipIndex int,
	errType errtype.Variation,
	msg string,
	var1 string,
	val1 interface{},
) *Wrapper

func NewRef2 added in v0.5.2

func NewRef2(
	stackSkipIndex int,
	errType errtype.Variation,
	error error,
	varName string,
	val interface{},
	varName2 string,
	val2 interface{},
) *Wrapper

func NewRef2Msg added in v0.7.0

func NewRef2Msg(
	stackSkipIndex int,
	errType errtype.Variation,
	msg string,
	var1 string,
	val1 interface{},
	var2 string,
	val2 interface{},
) *Wrapper

func NewRefOne added in v0.9.2

func NewRefOne(
	stackSkipIndex int,
	errType errtype.Variation,
	var1 string,
	val1 interface{},
) *Wrapper

func NewRefWithMessage added in v0.5.2

func NewRefWithMessage(
	stackSkipIndex int,
	errType errtype.Variation,
	message string,
	refValues ...ref.Value,
) *Wrapper

func NewRefs added in v0.5.2

func NewRefs(
	stackSkipIndex int,
	errType errtype.Variation,
	error error,
	refValues ...ref.Value,
) *Wrapper

func NewTypeUsingStackSkip added in v0.9.2

func NewTypeUsingStackSkip(stackSkipIndex int, errType errtype.Variation) *Wrapper

func NewUnknownMessage added in v0.9.0

func NewUnknownMessage(
	stackSkipIndex int,
	isDisplayableError bool,
	message string,
) *Wrapper

func NewUsingBasicErr added in v0.9.6

func NewUsingBasicErr(
	basicErrWrapper errcoreinf.BasicErrWrapper,
) *Wrapper

func NewUsingBasicErrStackSkip added in v0.9.6

func NewUsingBasicErrStackSkip(
	stackStartIndex int,
	basicErrWrapper errcoreinf.BasicErrWrapper,
) *Wrapper

func NewUsingError

func NewUsingError(
	stackSkipIndex int,
	errType errtype.Variation,
	err error,
) *Wrapper

func NewUsingErrorAndMessage added in v0.4.7

func NewUsingErrorAndMessage(
	stackSkipIndex int,
	err error,
	msg string,
) *Wrapper

func NewUsingErrorWithoutTypeDisplay

func NewUsingErrorWithoutTypeDisplay(
	errType errtype.Variation,
	err error,
) Wrapper

func NewUsingErrorWithoutTypeDisplayPtr added in v0.3.9

func NewUsingErrorWithoutTypeDisplayPtr(
	errType errtype.Variation,
	err error,
) *Wrapper

func NewUsingManyErrorInterfacesStackSkip added in v0.9.6

func NewUsingManyErrorInterfacesStackSkip(
	stackStartIndex int,
	errType errtype.Variation,
	errorInterfaces ...errcoreinf.BaseErrorOrCollectionWrapper,
) *Wrapper

func NewUsingTypeErrorAndMessage added in v0.4.7

func NewUsingTypeErrorAndMessage(
	stackSkipIndex int,
	errType errtype.Variation,
	err error,
	msg string,
) *Wrapper

func NewUsingWrapper added in v0.5.4

func NewUsingWrapper(
	stackSkipIndex int,
	currentWrapper *Wrapper,
	additionalReferences ...ref.Value,
) *Wrapper

func TypeReferenceQuick added in v0.7.0

func TypeReferenceQuick(
	stackSkipIndex int,
	errType errtype.Variation,
	referencesValues ...interface{},
) *Wrapper

TypeReferenceQuick - errorTypeName - (...., items)...

func (Wrapper) AsErrWrapperContractsBinder added in v0.9.6

func (it Wrapper) AsErrWrapperContractsBinder() ErrWrapperContractsBinder

func (Wrapper) AsErrorWrapper added in v0.7.3

func (it Wrapper) AsErrorWrapper() *Wrapper

func (Wrapper) AsJsonContractsBinder added in v0.4.9

func (it Wrapper) AsJsonContractsBinder() corejson.JsonContractsBinder

func (*Wrapper) Clone added in v0.8.4

func (it *Wrapper) Clone() Wrapper

func (*Wrapper) CloneInterface added in v0.9.6

func (it *Wrapper) CloneInterface() errcoreinf.BasicErrWrapper

func (*Wrapper) CloneNewStackSkipPtr added in v0.8.9

func (it *Wrapper) CloneNewStackSkipPtr(stackSkip int) *Wrapper

func (*Wrapper) ClonePtr added in v0.1.9

func (it *Wrapper) ClonePtr() *Wrapper

func (*Wrapper) CloneReferences added in v0.9.6

func (it *Wrapper) CloneReferences() *refs.Collection

func (*Wrapper) CodeTypeName added in v0.9.6

func (it *Wrapper) CodeTypeName() string

func (*Wrapper) Compile added in v0.9.6

func (it *Wrapper) Compile() string

Compile

Refers to the FullString

func (*Wrapper) CompileString added in v0.9.6

func (it *Wrapper) CompileString() string

CompileString

Refers to the FullString

func (*Wrapper) CompiledError added in v0.5.4

func (it *Wrapper) CompiledError() error

func (*Wrapper) CompiledErrorWithStackTraces added in v0.7.9

func (it *Wrapper) CompiledErrorWithStackTraces() error

func (*Wrapper) CompiledJsonErrorWithStackTraces added in v0.9.6

func (it *Wrapper) CompiledJsonErrorWithStackTraces() error

func (*Wrapper) CompiledJsonStringWithStackTraces added in v0.9.6

func (it *Wrapper) CompiledJsonStringWithStackTraces() (jsonString string)

func (*Wrapper) CompiledStackTracesString added in v0.9.6

func (it *Wrapper) CompiledStackTracesString() string

func (*Wrapper) ConcatNew added in v0.4.7

func (it *Wrapper) ConcatNew() ConcatNew

ConcatNew

It is safe to use for nil.

func (*Wrapper) Dispose added in v0.7.9

func (it *Wrapper) Dispose()

func (*Wrapper) ErrWrap added in v1.0.4

func (it *Wrapper) ErrWrap() *Wrapper

func (*Wrapper) Error

func (it *Wrapper) Error() error

func (*Wrapper) ErrorString

func (it *Wrapper) ErrorString() string

ErrorString if empty error then returns ""

func (*Wrapper) ErrorTypeAsBasicErrorTyper added in v0.9.6

func (it *Wrapper) ErrorTypeAsBasicErrorTyper() errcoreinf.BasicErrorTyper

func (*Wrapper) FullOrErrorMessage added in v0.7.1

func (it *Wrapper) FullOrErrorMessage(
	isErrorMessage,
	isWithRef bool,
) string

func (*Wrapper) FullString

func (it *Wrapper) FullString() string

func (*Wrapper) FullStringSplitByNewLine added in v0.7.1

func (it *Wrapper) FullStringSplitByNewLine() []string

func (*Wrapper) FullStringWithLimitTraces added in v0.7.9

func (it *Wrapper) FullStringWithLimitTraces(limit int) string

func (*Wrapper) FullStringWithTraces added in v0.7.9

func (it *Wrapper) FullStringWithTraces() string

func (*Wrapper) FullStringWithTracesIf added in v0.9.6

func (it *Wrapper) FullStringWithTracesIf(
	isStackTraces bool,
) string

func (*Wrapper) FullStringWithoutReferences added in v0.9.2

func (it *Wrapper) FullStringWithoutReferences() string

func (*Wrapper) GetAsBasicWrapper added in v0.9.6

func (it *Wrapper) GetAsBasicWrapper() errcoreinf.BasicErrWrapper

func (*Wrapper) GetAsBasicWrapperUsingTyper added in v0.9.6

func (it *Wrapper) GetAsBasicWrapperUsingTyper(
	errorTyper errcoreinf.BasicErrorTyper,
) errcoreinf.BasicErrWrapper

func (*Wrapper) GetTypeVariantStruct

func (it *Wrapper) GetTypeVariantStruct() errtype.VariantStructure

func (*Wrapper) HandleError

func (it *Wrapper) HandleError()

HandleError

Only call panic if Wrapper has currentError

func (*Wrapper) HandleErrorWithMsg

func (it *Wrapper) HandleErrorWithMsg(newMessage string)

HandleErrorWithMsg Only call panic if has currentError

func (*Wrapper) HandleErrorWithRefs

func (it *Wrapper) HandleErrorWithRefs(
	newMessage string,
	refVar,
	refVal interface{},
)

func (*Wrapper) HasAnyError added in v0.9.6

func (it *Wrapper) HasAnyError() bool

func (*Wrapper) HasAnyIssues added in v0.9.6

func (it *Wrapper) HasAnyIssues() bool

func (*Wrapper) HasCurrentError added in v0.8.9

func (it *Wrapper) HasCurrentError() bool

HasCurrentError

Refers to Wrapper error embedded or not.

Best to use HasError

func (*Wrapper) HasError

func (it *Wrapper) HasError() bool

HasError

Returns true if not empty. Invert of IsEmpty()

Conditions (true):

  • if Wrapper is NOT nil, Or,
  • if Wrapper is NOT StaticEmptyPtr, Or,
  • if Wrapper .errorType is NOT IsNoError(), Or,
  • if Wrapper .currentError is nil and Wrapper .references.IsEmpty()

func (*Wrapper) HasReferences added in v0.9.6

func (it *Wrapper) HasReferences() bool

func (*Wrapper) IsAnyNull added in v0.8.9

func (it *Wrapper) IsAnyNull() bool

func (*Wrapper) IsBasicErrEqual added in v0.9.6

func (it *Wrapper) IsBasicErrEqual(
	another errcoreinf.BasicErrWrapper,
) bool

func (*Wrapper) IsCollect added in v0.9.6

func (it *Wrapper) IsCollect(
	another errcoreinf.BaseErrorOrCollectionWrapper,
) bool

IsCollect

ConcatNew() recommend to use instead.

Warning :

mutates current error, recommended NOT use,
it is for the commonalities between error Wrapper and collection

func (*Wrapper) IsCollectOn added in v0.9.6

func (it *Wrapper) IsCollectOn(
	isCollect bool,
	another errcoreinf.BaseErrorOrCollectionWrapper,
) bool

IsCollectOn

ConcatNew() recommend to use instead.

Warning :

mutates current error, recommended NOT use,
it is for the commonalities between error Wrapper and collection

func (*Wrapper) IsCollectedAny added in v0.9.6

func (it *Wrapper) IsCollectedAny(
	anotherItems ...errcoreinf.BaseErrorOrCollectionWrapper,
) bool

IsCollectedAny

ConcatNew() recommend to use instead.

Warning :

mutates current error, recommended NOT use,
it is for the commonalities between error Wrapper and collection

func (*Wrapper) IsCollectionType added in v0.9.6

func (it *Wrapper) IsCollectionType() bool

func (*Wrapper) IsDefined added in v0.9.6

func (it *Wrapper) IsDefined() bool

func (*Wrapper) IsEmpty

func (it *Wrapper) IsEmpty() bool

IsEmpty

Refers to no error for print or doesn't treat this as error.

Conditions (true):

  • if Wrapper nil, Or,
  • if Wrapper is StaticEmptyPtr, Or,
  • if Wrapper .errorType is IsNoError(), Or,
  • if Wrapper .currentError NOT nil and Wrapper .references.IsEmpty()

func (*Wrapper) IsEmptyAll added in v0.9.6

func (it *Wrapper) IsEmptyAll(
	anotherItems ...errcoreinf.BaseErrorOrCollectionWrapper,
) bool

func (*Wrapper) IsEmptyError added in v0.4.9

func (it *Wrapper) IsEmptyError() bool

func (*Wrapper) IsEquals

func (it *Wrapper) IsEquals(right *Wrapper) bool

func (*Wrapper) IsErrorEquals

func (it *Wrapper) IsErrorEquals(err error) bool

func (*Wrapper) IsErrorMessage

func (it *Wrapper) IsErrorMessage(msg string, isCaseSensitive bool) bool

IsErrorMessage

If error IsEmpty then returns false regardless

func (*Wrapper) IsErrorMessageContains

func (it *Wrapper) IsErrorMessageContains(
	msg string,
	isCaseSensitive bool,
) bool

IsErrorMessageContains If error IsEmpty then returns false regardless

func (*Wrapper) IsErrorMessageEqual

func (it *Wrapper) IsErrorMessageEqual(msg string) bool

func (*Wrapper) IsFailed added in v0.7.0

func (it *Wrapper) IsFailed() bool

func (*Wrapper) IsInvalid added in v0.9.6

func (it *Wrapper) IsInvalid() bool

func (*Wrapper) IsNoError added in v0.9.6

func (it *Wrapper) IsNoError() bool

func (*Wrapper) IsNotEquals added in v0.8.9

func (it *Wrapper) IsNotEquals(right *Wrapper) bool

func (*Wrapper) IsNull added in v0.8.9

func (it *Wrapper) IsNull() bool

func (*Wrapper) IsReferencesEmpty added in v0.0.4

func (it *Wrapper) IsReferencesEmpty() bool

func (*Wrapper) IsSuccess added in v0.7.0

func (it *Wrapper) IsSuccess() bool

func (*Wrapper) IsTypeOf

func (it *Wrapper) IsTypeOf(errType errtype.Variation) bool

func (*Wrapper) IsValid added in v0.7.0

func (it *Wrapper) IsValid() bool

func (*Wrapper) Json added in v0.4.0

func (it *Wrapper) Json() corejson.Result

func (*Wrapper) JsonModel added in v0.4.0

func (it *Wrapper) JsonModel() WrapperDataModel

func (*Wrapper) JsonModelAny added in v0.4.0

func (it *Wrapper) JsonModelAny() interface{}

func (*Wrapper) JsonParseSelfInject added in v0.4.0

func (it *Wrapper) JsonParseSelfInject(
	jsonResult *corejson.Result,
) error

func (*Wrapper) JsonPtr added in v0.7.9

func (it *Wrapper) JsonPtr() *corejson.Result

func (*Wrapper) JsonResultWithoutTraces added in v0.9.8

func (it *Wrapper) JsonResultWithoutTraces() *corejson.Result

func (*Wrapper) Log added in v0.4.0

func (it *Wrapper) Log()

func (*Wrapper) LogFatal added in v0.4.0

func (it *Wrapper) LogFatal()

func (*Wrapper) LogFatalWithTraces added in v0.8.0

func (it *Wrapper) LogFatalWithTraces()

func (*Wrapper) LogIf added in v0.9.6

func (it *Wrapper) LogIf(isLog bool)

func (*Wrapper) LogWithTraces added in v0.8.0

func (it *Wrapper) LogWithTraces()

func (*Wrapper) MarshalJSON added in v0.4.0

func (it *Wrapper) MarshalJSON() ([]byte, error)

func (*Wrapper) MergeNewErrInf added in v0.9.6

func (*Wrapper) MergeNewMessage added in v0.9.6

func (it *Wrapper) MergeNewMessage(
	newMessage string,
) errcoreinf.BaseErrorOrCollectionWrapper

func (*Wrapper) MergeNewReferences added in v0.9.4

func (it *Wrapper) MergeNewReferences(
	additionalReferences ...ref.Value,
) *refs.Collection

func (*Wrapper) MustBeEmpty added in v0.9.6

func (it *Wrapper) MustBeEmpty()

func (*Wrapper) MustBeEmptyError added in v0.9.6

func (it *Wrapper) MustBeEmptyError()

func (*Wrapper) MustBeSafe added in v0.9.6

func (it *Wrapper) MustBeSafe()

func (*Wrapper) NewDefaultStackTraces added in v0.9.6

func (it *Wrapper) NewDefaultStackTraces() string

func (*Wrapper) NewDefaultStackTracesJsonResult added in v0.9.6

func (it *Wrapper) NewDefaultStackTracesJsonResult() *corejson.Result

func (*Wrapper) NewStackTraces added in v0.9.6

func (it *Wrapper) NewStackTraces(
	stackSkip int,
) string

func (*Wrapper) NewStackTracesJsonResult added in v0.9.6

func (it *Wrapper) NewStackTracesJsonResult(
	stackSkip int,
) *corejson.Result

func (*Wrapper) NonPtr added in v0.8.9

func (it *Wrapper) NonPtr() Wrapper

func (*Wrapper) ParseInjectUsingJson added in v0.4.0

func (it *Wrapper) ParseInjectUsingJson(
	jsonResult *corejson.Result,
) (*Wrapper, error)

func (*Wrapper) ParseInjectUsingJsonMust added in v0.4.0

func (it *Wrapper) ParseInjectUsingJsonMust(
	jsonResult *corejson.Result,
) *Wrapper

ParseInjectUsingJsonMust Panic if error

func (Wrapper) Ptr added in v0.8.9

func (it Wrapper) Ptr() *Wrapper

func (*Wrapper) RawErrorTypeName added in v0.8.3

func (it *Wrapper) RawErrorTypeName() string

func (*Wrapper) RawErrorTypeValue added in v0.9.6

func (it *Wrapper) RawErrorTypeValue() uint16

func (*Wrapper) References added in v0.6.3

func (it *Wrapper) References() *refs.Collection

func (Wrapper) ReferencesCollection added in v0.9.6

func (it Wrapper) ReferencesCollection() errcoreinf.ReferenceCollectionDefiner

func (*Wrapper) ReferencesCompiledString added in v0.9.6

func (it *Wrapper) ReferencesCompiledString() string

func (*Wrapper) ReferencesList added in v0.9.6

func (it *Wrapper) ReferencesList() []errcoreinf.Referencer

func (*Wrapper) ReflectSetTo added in v0.9.6

func (it *Wrapper) ReflectSetTo(toPtr interface{}) error

ReflectSetTo

Set any object from to toPointer object

Valid Inputs or Supported (https://t.ly/1Lpt):

  • From, To: (null, null) -- do nothing
  • From, To: (sameTypePointer, sameTypePointer) -- try reflection
  • From, To: (sameTypeNonPointer, sameTypePointer) -- try reflection
  • From, To: ([]byte or *[]byte, otherType) -- try unmarshal, reflect
  • From, To: (otherType, *[]byte) -- try marshal, reflect

Validations:

  • Check null, if both null no error return quickly.
  • NotSupported returns as error.
  • NotSupported: (from, to) - (..., not pointer)
  • NotSupported: (from, to) - (null, notNull)
  • NotSupported: (from, to) - (notNull, null)
  • NotSupported: (from, to) - not same type and not bytes on any
  • `From` null or nil is not supported and will return error.

Reference:

func (*Wrapper) ReflectSetToErrWrap added in v0.9.6

func (it *Wrapper) ReflectSetToErrWrap(
	toPtr interface{},
) *Wrapper

ReflectSetToErrWrap

Reusing ReflectSetTo

func (*Wrapper) Serialize added in v0.9.6

func (it *Wrapper) Serialize() ([]byte, error)

Serialize

Returns json with stack-traces

func (*Wrapper) SerializeMust added in v0.9.6

func (it *Wrapper) SerializeMust() []byte

func (*Wrapper) SerializeWithoutTraces added in v0.9.6

func (it *Wrapper) SerializeWithoutTraces() ([]byte, error)

func (*Wrapper) SerializeWithoutTracesMust added in v1.0.3

func (it *Wrapper) SerializeWithoutTracesMust() []byte

func (*Wrapper) StackTraceString added in v0.7.9

func (it *Wrapper) StackTraceString() string

func (*Wrapper) StackTraces added in v0.9.6

func (it *Wrapper) StackTraces() string

func (*Wrapper) StackTracesJsonResult added in v0.9.6

func (it *Wrapper) StackTracesJsonResult() *corejson.Result

func (*Wrapper) StackTracesLimit added in v0.7.9

func (it *Wrapper) StackTracesLimit(limit int) *codestack.TraceCollection

func (*Wrapper) String

func (it *Wrapper) String() string

func (*Wrapper) StringIf added in v0.9.2

func (it *Wrapper) StringIf(isWithRef bool) string

func (*Wrapper) ToNonPtr added in v1.0.3

func (it *Wrapper) ToNonPtr() Wrapper

func (Wrapper) ToPtr added in v1.0.3

func (it Wrapper) ToPtr() *Wrapper

func (*Wrapper) Type

func (it *Wrapper) Type() errtype.Variation

func (*Wrapper) TypeCodeNameString added in v0.8.3

func (it *Wrapper) TypeCodeNameString() string

TypeCodeNameString

Format : errconsts.ErrorCodeWithTypeNameFormat

"(Code - #%d) : %s"

func (*Wrapper) TypeName added in v0.8.3

func (it *Wrapper) TypeName() string

TypeName

Returns error type name,
on empty returns empty string.

Example :

  • For errtype.NoError : ""
  • For errtype.Generic : "Generic"

func (*Wrapper) TypeNameCode added in v0.8.3

func (it *Wrapper) TypeNameCode() string

TypeNameCode

Returns error type Code number value with name,
on empty returns empty string.

Format :

  • "(#%d - %s)"
  • "(#1 - Generic)"

func (*Wrapper) TypeNameCodeMessage added in v0.9.6

func (it *Wrapper) TypeNameCodeMessage() string

func (*Wrapper) TypeNameWithCustomMessage added in v0.8.3

func (it *Wrapper) TypeNameWithCustomMessage(
	customMessage string,
) string

TypeNameWithCustomMessage

errconsts.ErrorCodeHyphenTypeNameWithLineFormat = "(#%d - %s) %s"

func (*Wrapper) TypeString

func (it *Wrapper) TypeString() string

TypeString

Returns whole type string, should be refactored to whole-type string name

Format :
 - errconsts.VariantStructStringFormat
 - "%s (Code - %d) : %s" : "Name (Code - ValueInt) : Message from type string"
 - Exact Example for errtype.Generic : "Generic (Code - 1) : Generic error"

func (*Wrapper) UnmarshalJSON added in v0.4.0

func (it *Wrapper) UnmarshalJSON(data []byte) error

func (*Wrapper) ValidationErrUsingTextValidator added in v0.7.1

func (it *Wrapper) ValidationErrUsingTextValidator(
	validator *corevalidator.TextValidator,
	params *corevalidator.ValidatorParamsBase,
) *Wrapper

func (*Wrapper) Value

func (it *Wrapper) Value() error

type WrapperDataModel added in v0.4.0

type WrapperDataModel struct {
	IsDisplayableError bool
	CurrentError       string
	ErrorType          errtype.Variation
	StackTraces        codestack.TraceCollection
	References         *refs.Collection
	HasError           bool
}

func NewDataModel added in v0.4.0

func NewDataModel(wrapper *Wrapper) WrapperDataModel

Jump to

Keyboard shortcuts

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