exception

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 1 Imported by: 1

README

go-exception

go-exception

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SuccessCode int64 = 0
	FailureCode int64 = -1
	Success           = New(SuccessCode, "success")
	Failure           = New(FailureCode, "failure")
)

Functions

func IsError

func IsError(e interface{}) bool

Types

type Exception

type Exception interface {
	GetCode() int64
	GetSubException() Exception
	GetMessage() string
	Error() string
	SubError(err error) Exception
	NewSubError(code int64, msg string) Exception
}

func GenerateWhenError

func GenerateWhenError(mainException Exception, err error) Exception

*

  • 如果 err为一个err的话,返回最终的exception,否则,返回nil
  • param: Exception mainException
  • param: error err
  • return Exception | nil

func New

func New(code int64, message string) Exception

func NewFromError

func NewFromError(err error) Exception

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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