errors

package
v0.3.0-beta Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BusinessError

type BusinessError struct {
	Message   string `json:"message"`
	ErrorCode string `json:"error_code"`
}

func Business

func Business(message, code string) BusinessError

func (BusinessError) Error

func (e BusinessError) Error() string

Error string

func (BusinessError) Msgf

func (e BusinessError) Msgf(params ...interface{}) BusinessError

func (BusinessError) ToJSON

func (e BusinessError) ToJSON() []byte

ToJSON error

type NotFoundError

type NotFoundError struct {
	BusinessError
}

func NotFound

func NotFound(resource, code string) NotFoundError

NotFound error

type SystemError

type SystemError struct {
	BusinessError
	Reason error `json:"reason"`
}

func System

func System(reason error, message, code string) SystemError

func (SystemError) Error

func (e SystemError) Error() string

func (SystemError) ToJSON

func (e SystemError) ToJSON() []byte

func (SystemError) WithErr

func (e SystemError) WithErr(err error) SystemError

type ValidationError

type ValidationError struct {
	BusinessError
	Details []error `json:"details,omitempty"`
}

func Validation

func Validation(message, code string, details ...error) ValidationError

Validation error build

func (ValidationError) ToJSON

func (e ValidationError) ToJSON() []byte

Jump to

Keyboard shortcuts

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