fault

package
v0.0.0-...-f9b006c Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	BasicAppError
	// contains filtered or unexported fields
}

Record not found for email = {{.email}} data[string]any={"email":"your@email.com"}

func (*AppError) AppendCause

func (e *AppError) AppendCause() Fault

AppendCause will append the error cause to the err string

func (*AppError) Cause

func (e *AppError) Cause() error

func (*AppError) Causes

func (e *AppError) Causes() []error

func (*AppError) Data

func (e *AppError) Data() map[string]interface{}

func (*AppError) Error

func (e *AppError) Error() string

func (*AppError) Retryable

func (e *AppError) Retryable() bool

func (*AppError) SetCause

func (e *AppError) SetCause(cause error) Fault

func (*AppError) SetRetryable

func (e *AppError) SetRetryable() Fault

func (*AppError) SetSource

func (e *AppError) SetSource(s string) Fault

func (*AppError) Source

func (e *AppError) Source() string

func (*AppError) ToMessageAwareFault

func (e *AppError) ToMessageAwareFault(i18nBundle *i18n.Bundle) MessageAwareFault

type AppErrorMessage

type AppErrorMessage struct {
	AppError
	// contains filtered or unexported fields
}

func (*AppErrorMessage) ErrorString

func (e *AppErrorMessage) ErrorString() string

func (*AppErrorMessage) Message

func (e *AppErrorMessage) Message(lang string) string

func (*AppErrorMessage) String

func (e *AppErrorMessage) String() string

type BasicAppError

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

func (*BasicAppError) Code

func (e *BasicAppError) Code() ErrorCode

func (*BasicAppError) Component

func (p *BasicAppError) Component() ErrComponent

func (*BasicAppError) Error

func (e *BasicAppError) Error() string

func (*BasicAppError) ResponseErrType

func (p *BasicAppError) ResponseErrType() ResponseErrType

func (*BasicAppError) SetComponent

func (p *BasicAppError) SetComponent(component ErrComponent) BasicFault

func (*BasicAppError) SetResponseType

func (p *BasicAppError) SetResponseType(reponse ResponseErrType) BasicFault

func (*BasicAppError) ToFault

func (e *BasicAppError) ToFault(data map[string]any, cause error) Fault

type BasicFault

type BasicFault interface {
	error
	ResponseErrType() ResponseErrType
	SetResponseType(r ResponseErrType) BasicFault
	Component() ErrComponent
	SetComponent(c ErrComponent) BasicFault
	Code() ErrorCode
	ToFault(data map[string]any, cause error) Fault
}

func NewBasicFault

func NewBasicFault(
	code ErrorCode,
) BasicFault

type BasicFaultsCache

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

func NewBasicFaultCache

func NewBasicFaultCache(partialFaults map[ErrorCode]BasicFault) BasicFaultsCache

func (*BasicFaultsCache) AppendBasicFaults

func (fc *BasicFaultsCache) AppendBasicFaults(bfaults map[ErrorCode]BasicFault)

func (*BasicFaultsCache) GetBasicFault

func (p *BasicFaultsCache) GetBasicFault(code ErrorCode) BasicFault

func (*BasicFaultsCache) GetBasicFaults

func (fc *BasicFaultsCache) GetBasicFaults() map[ErrorCode]BasicFault

func (*BasicFaultsCache) IsEmpty

func (fc *BasicFaultsCache) IsEmpty() bool

func (*BasicFaultsCache) Size

func (fc *BasicFaultsCache) Size() int

type ErrComponent

type ErrComponent string

type ErrorCode

type ErrorCode string

func (ErrorCode) String

func (e ErrorCode) String() string

type Fault

type Fault interface {
	BasicFault
	Cause() error
	Causes() []error
	Data() map[string]interface{}
	Source() string
	SetSource(s string) Fault
	Retryable() bool
	SetRetryable() Fault
	AppendCause() Fault
	SetCause(cause error) Fault
	ToMessageAwareFault(*i18n.Bundle) MessageAwareFault
}

Env {{.var}} var not found

{
  "var": "db_name"
}

type MessageAwareFault

type MessageAwareFault interface {
	Fault
	Message(lang string) string
	String() string
	ErrorString() string
}

Message Aware Fault will be responsible getting errors, message and localization of message.

type ResponseErrType

type ResponseErrType string

Jump to

Keyboard shortcuts

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