Documentation
¶
Overview ¶
异常处理
Index ¶
- func Do(fn func(), f ...ExceptionHandlerFunc)
- func Go(fn func(), f ...ExceptionHandlerFunc)
- func SetExceptionHandler(fn ExceptionHandlerFunc)
- func Throw(e interface{}, args ...interface{})
- func ThrowFatal(title string, errs ...interface{})
- func ThrowFatalf(title string, format string, errs ...interface{})
- func ThrowInfo(title string, errs ...interface{})
- func ThrowInfof(title string, format string, errs ...interface{})
- func ThrowWarn(title string, errs ...interface{})
- func ThrowWarnf(title string, format string, errs ...interface{})
- type Exception
- type ExceptionBase
- func (this *ExceptionBase) GetData() interface{}
- func (this *ExceptionBase) GetMsg() string
- func (this *ExceptionBase) Init(msg string, data interface{})
- func (this *ExceptionBase) Name() string
- func (this *ExceptionBase) Println(a ...interface{})
- func (this *ExceptionBase) Stack() string
- func (this *ExceptionBase) String() string
- type ExceptionFatal
- type ExceptionHandlerFunc
- type ExceptionInfo
- type ExceptionRuntime
- type ExceptionWarn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Go ¶
func Go(fn func(), f ...ExceptionHandlerFunc)
开启一个可以捕捉异常的安全协程,建议程序中全部使用此方法启动协程 必须对协程做异常处理,catch里面不能再次Throw
Types ¶
type Exception ¶
type Exception interface { Init(msg string, data interface{}) Name() string //异常名称 GetMsg() string //异常消息 GetData() interface{} //异常数据 String() string //异常数据字符串输出 Stack() string //堆栈 }
异常接口
type ExceptionBase ¶
type ExceptionBase struct {
// contains filtered or unexported fields
}
默认异常
func (*ExceptionBase) Name ¶
func (this *ExceptionBase) Name() string
func (*ExceptionBase) Println ¶
func (this *ExceptionBase) Println(a ...interface{})
type ExceptionFatal ¶
type ExceptionFatal struct {
ExceptionBase
}
致命级别错误(不可输出到前台)-----------
func (*ExceptionFatal) Name ¶
func (this *ExceptionFatal) Name() string
type ExceptionRuntime ¶
type ExceptionRuntime struct {
ExceptionBase
}
运行时异常-------------------------
func (*ExceptionRuntime) Name ¶
func (this *ExceptionRuntime) Name() string
type ExceptionWarn ¶
type ExceptionWarn struct {
ExceptionBase
}
警告级别错误(可输出到前台)--------------
func (*ExceptionWarn) Name ¶
func (this *ExceptionWarn) Name() string
Click to show internal directories.
Click to hide internal directories.