res

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldCode    = "Code"
	FieldMessage = "Msg"
	FieldData    = "Data"
)

Variables

View Source
var (
	OK = ErrorMessageCode(code.CodeOk, "ok")

	ParameterError = ErrorMessageCode(code.CodeParameterError, "Parameter Error")
	ServiceError   = ErrorMessageCode(code.CodeParameterError, "Service Error")
)

Functions

func Join

func Join(errs ...error) error

Join returns an error that wraps the given errors. Any nil error values are discarded. Join returns nil if errs contains no non-nil values. The error formats as the concatenation of the strings obtained by calling the Error method of each element of errs, with a newline between each string.

Types

type ResponseError

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

func ErrorCode

func ErrorCode(code code.Code, err error) *ResponseError

func ErrorMessageCode

func ErrorMessageCode(code code.Code, message string) *ResponseError

func (*ResponseError) AddError

func (e *ResponseError) AddError(err error) *ResponseError

AddError @Description: 将错误添加到错误信息中 @receiver e @param err

func (*ResponseError) AddMessage

func (e *ResponseError) AddMessage(message string) *ResponseError

func (*ResponseError) BuildRESTful

func (e *ResponseError) BuildRESTful() *rest.R

BuildRESTful deprecated

func (*ResponseError) BuildRESTfulData

func (e *ResponseError) BuildRESTfulData(data interface{}) *rest.R

BuildRESTfulData deprecated

func (*ResponseError) BuildRPC

func (e *ResponseError) BuildRPC() *rpc.R

BuildRPC deprecated

func (*ResponseError) BuildRPCPbData

func (e *ResponseError) BuildRPCPbData(data proto.Message) *rpc.R

BuildRPCPbData deprecated

func (*ResponseError) BuildResult

func (e *ResponseError) BuildResult(message interface{}, errs ...error)

func (*ResponseError) BuildResultData

func (e *ResponseError) BuildResultData(message interface{}, data interface{})

func (*ResponseError) Code

func (e *ResponseError) Code() code.Code

func (*ResponseError) Error

func (e *ResponseError) Error() string

type ResponseErrorInterface

type ResponseErrorInterface interface {
	error
	Code() code.Code
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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