domainerrors

package
v0.0.0-...-eecab09 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GruopID = "PAAC"
	// Adapter Layer Error Code Offset.
	ErrorCodeAdapter         = 100000000
	ErrorCodeAdapterHTTP     = 010000000
	ErrorCodeAdapterMessage  = 020000000
	ErrorCodeAdapterUser     = 001000000
	ErrorCodeAdapterRole     = 002000000
	ErrorCodeAdapterGroup    = 003000000
	ErrorCodeAdapterWallet   = 004000000
	ErrorCodeAdapterCurrency = 005000000
	// Application Layer Error Code Offset.
	ErrorCodeApplication         = 200000000
	ErrorCodeApplicationUser     = 010000000
	ErrorCodeApplicationRole     = 020000000
	ErrorCodeApplicationGroup    = 030000000
	ErrorCodeApplicationWallet   = 040000000
	ErrorCodeApplicationCurrency = 050000000
	// Domain Layer Error Code Offset.
	ErrorCodeDomain         = 300000000
	ErrorCodeDomainEntity   = 010000000
	ErrorCodeDomainEvent    = 020000000
	ErrorCodeDomainUser     = 001000000
	ErrorCodeDomainRole     = 002000000
	ErrorCodeDomainGroup    = 003000000
	ErrorCodeDomainWallet   = 004000000
	ErrorCodeDomainCurrency = 005000000
	// Infra Layer Error Code Offset.
	ErrorCodeInfra           = 200000000
	ErrorCodeInfraDatasource = 010000000
	ErrorCodeInfraDTO        = 020000000
	ErrorCodeInfraRepo       = 030000000
	// Infra Layer Datasource Error Code.
	ErrorCodeInfraDatasourceSQL        = 001000000
	ErrorCodeInfraDatasourceCache      = 002000000
	ErrorCodeInfraDatasourceEventStore = 003000000
	// Infra Layer DTO Error Code.
	ErrorCodeInfraDTOMapper = 001000000
	ErrorCodeInfraDTOVO     = 002000000
	ErrorCodeInfraDTOBase   = 003000000
	ErrorCodeInfraDTOList   = 004000000
	// Infra Layer Repository Error Code.
	ErrorCodeInfraRepoCRUD        = 001000000
	ErrorCodeInfraRepoTransaction = 002000000
	ErrorCodeInfraRepoUser        = 003000000
	ErrorCodeInfraRepoRole        = 004000000
	ErrorCodeInfraRepoGroup       = 005000000
	ErrorCodeInfraRepoWallet      = 006000000
	ErrorCodeInfraRepoCurrency    = 007000000

	ErrorCodeSystem = 900000000
)

Variables

This section is empty.

Functions

func Cause

func Cause(err error) error

Cause returns the underlying cause of an error, if available.

func IsErrorCode

func IsErrorCode(err error, code string) bool

IsErrorCode returns true if the given error has the given error code.

Types

type ErrorInfo

type ErrorInfo struct {
	Code    string      `json:"code"`
	Message string      `json:"error"`
	Err     interface{} `json:"-"`
}

func New

func New(code string, msg string) *ErrorInfo

New returns a new error with an error code and error message.

func Wrap

func Wrap(errorCode int, err error) *ErrorInfo

Wrap returns a new error with an error code and error message, wrapping an existing error.

func WrapWithSpan

func WrapWithSpan(errorCode int, err error, span trace.Span) *ErrorInfo

func (*ErrorInfo) Error

func (e *ErrorInfo) Error() string

ErrorInfo implements the error interface.

func (*ErrorInfo) MarshalJSON

func (e *ErrorInfo) MarshalJSON() ([]byte, error)

Jump to

Keyboard shortcuts

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