SpringError

package
v1.0.0-rc Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2020 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERROR   = NewRpcError(-1, "ERROR")
	SUCCESS = NewRpcSuccess(0, "SUCCESS")
)

Functions

This section is empty.

Types

type ErrorCode

type ErrorCode struct {
	Code int32  // 错误码
	Msg  string // 错误信息
}

错误码

func NewErrorCode

func NewErrorCode(code int32, msg string) ErrorCode

type RpcError

type RpcError ErrorCode

定义一个 RPC 异常值

func NewRpcError

func NewRpcError(code int32, msg string) RpcError

func (RpcError) Error

func (r RpcError) Error(err string) *RpcResult

func (RpcError) Panic

func (r RpcError) Panic(err error) *SpringUtils.PanicCond

抛出一个异常值

type RpcResult

type RpcResult struct {
	ErrorCode

	Err  string      // 错误源
	Data interface{} // 返回值
}

定义 RPC 返回值

type RpcSuccess

type RpcSuccess ErrorCode

定义一个 RPC 成功值

func NewRpcSuccess

func NewRpcSuccess(code int32, msg string) RpcSuccess

func (RpcSuccess) Data

func (r RpcSuccess) Data(data interface{}) *RpcResult

Jump to

Keyboard shortcuts

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