errsvc

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: Apache-2.0 Imports: 1 Imported by: 7

Documentation

Overview

err package define the register of business errors

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrEqualCode

func IsErrEqualCode(err error, targetCode int32) bool

IsCodeEqual reports whether the err's code equal the target code

Types

type Error

type Error struct {
	Code    int32  `json:"errorCode,string"`
	Message string `json:"errorMessage"`
	Detail  string `json:"detail,omitempty"`
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) InternalError

func (e *Error) InternalError() bool

func (*Error) StatusCode

func (e *Error) StatusCode() int

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) MustRegister

func (m *Manager) MustRegister(code int32, message string)

func (*Manager) MustRegisterMap

func (m *Manager) MustRegisterMap(errs map[int32]string)

func (*Manager) NewError

func (m *Manager) NewError(code int32, detail string) *Error

Jump to

Keyboard shortcuts

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