common

package
v0.0.0-...-0e0a2a2 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorCodeAuthNotAuthenticated = ErrorCode{
	Name:       "AUTH_NOT_AUTHENTICATED",
	StatusCode: http.StatusUnauthorized,
}
View Source
var ErrorCodeAuthPermissionDenied = ErrorCode{
	Name:       "AUTH_PERMISSION_DENIED",
	StatusCode: http.StatusForbidden,
}
View Source
var ErrorCodeInternalProcess = ErrorCode{
	Name:       "INTERNAL_PROCESS",
	StatusCode: http.StatusInternalServerError,
}
View Source
var ErrorCodeParameterInvalid = ErrorCode{
	Name:       "PARAMETER_INVALID",
	StatusCode: http.StatusBadRequest,
}
View Source
var ErrorCodeRemoteProcess = ErrorCode{
	Name:       "REMOTE_PROCESS_ERROR",
	StatusCode: http.StatusBadGateway,
}
View Source
var ErrorCodeResourceNotFound = ErrorCode{
	Name:       "RESOURCE_NOT_FOUND",
	StatusCode: http.StatusNotFound,
}

Functions

This section is empty.

Types

type DomainError

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

DomainError used for expressing errors occurring in application.

func (DomainError) ClientMsg

func (e DomainError) ClientMsg() string

func (DomainError) Detail

func (e DomainError) Detail() map[string]interface{}

func (DomainError) Error

func (e DomainError) Error() string

func (DomainError) HTTPStatus

func (e DomainError) HTTPStatus() int

func (DomainError) Name

func (e DomainError) Name() string

func (DomainError) RemoteHTTPStatus

func (e DomainError) RemoteHTTPStatus() int

type Error

type Error interface {
	Error() string
	ClientMsg() string
}

Error indicates a domain error

func NewError

func NewError(code ErrorCode, err error, opts ...ErrorOption) Error

type ErrorCode

type ErrorCode struct {
	Name       string
	StatusCode int
}

type ErrorOption

type ErrorOption func(*DomainError)

func WithDetail

func WithDetail(detail map[string]interface{}) ErrorOption

func WithMsg

func WithMsg(msg string) ErrorOption

func WithStatus

func WithStatus(status int) ErrorOption

Jump to

Keyboard shortcuts

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