Documentation ¶
Index ¶
- Constants
- Variables
- func Join(errs ...error) error
- type ResponseError
- func (e *ResponseError) AddError(err error) *ResponseError
- func (e *ResponseError) AddMessage(message string) *ResponseError
- func (e *ResponseError) BuildRESTful() *rest.R
- func (e *ResponseError) BuildRESTfulData(data interface{}) *rest.R
- func (e *ResponseError) BuildRPC() *rpc.R
- func (e *ResponseError) BuildRPCPbData(data proto.Message) *rpc.R
- func (e *ResponseError) BuildResult(message interface{}, errs ...error)
- func (e *ResponseError) BuildResultData(message interface{}, data interface{})
- func (e *ResponseError) Code() code.Code
- func (e *ResponseError) Error() string
- type ResponseErrorInterface
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 ¶
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) 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
Click to show internal directories.
Click to hide internal directories.