errorx

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package errorx

@author: xwc1125

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error interface {
	Error() string  // 错误信息
	ErrorCode() int // 错误码
}

type RespInfo

type RespInfo struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitempty"`
}

func Errord

func Errord(code int, data interface{}, msg string) RespInfo

func Errordf

func Errordf(code int, data interface{}, format string, a ...interface{}) RespInfo

func Errorf

func Errorf(code int, format string, a ...interface{}) RespInfo

Errorf returns Error(code, fmt.Sprintf(format, a...)).

func Errorw

func Errorw(code int, msg string) RespInfo

func (RespInfo) Error

func (err RespInfo) Error() string

func (RespInfo) ErrorCode

func (err RespInfo) ErrorCode() int

func (RespInfo) ErrorData

func (err RespInfo) ErrorData() interface{}

func (RespInfo) String

func (err RespInfo) String() string

Jump to

Keyboard shortcuts

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