Documentation ¶
Overview ¶
Package try...
Description : catch 的实现
Author : go_developer@163.com<白茶清欢>
Date : 2021-07-24 10:10 下午
Package try...
Description : 各种接口定义
Author : go_developer@163.com<白茶清欢>
Date : 2021-07-24 9:47 下午
Index ¶
- type CatchHandler
- func (ch *CatchHandler) Catch(err error, handler func(err2 error)) ICatchHandler
- func (ch *CatchHandler) CatchAll(handler func(err error)) FinalHandler
- func (ch *CatchHandler) ErrorHasDeal() bool
- func (ch *CatchHandler) Finally(handlers ...func())
- func (ch *CatchHandler) HasError() bool
- func (ch *CatchHandler) NeedDeal() bool
- type FinalHandler
- type ICatchHandler
- type SystemError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CatchHandler ¶
type CatchHandler struct {
// contains filtered or unexported fields
}
CatchHandler catch的处理
Author : go_developer@163.com<白茶清欢>
Date : 9:55 下午 2021/7/24
func (*CatchHandler) Catch ¶
func (ch *CatchHandler) Catch(err error, handler func(err2 error)) ICatchHandler
Catch ...
Author : go_developer@163.com<白茶清欢>
Date : 10:29 下午 2021/7/24
func (*CatchHandler) CatchAll ¶
func (ch *CatchHandler) CatchAll(handler func(err error)) FinalHandler
CatchAll ...
Author : go_developer@163.com<白茶清欢>
Date : 10:29 下午 2021/7/24
func (*CatchHandler) ErrorHasDeal ¶
func (ch *CatchHandler) ErrorHasDeal() bool
ErrorHasDeal 异常已经处理
Author : go_developer@163.com<白茶清欢>
Date : 10:01 下午 2021/7/24
func (*CatchHandler) Finally ¶
func (ch *CatchHandler) Finally(handlers ...func())
func (*CatchHandler) HasError ¶
func (ch *CatchHandler) HasError() bool
HasError 判断是否有异常
Author : go_developer@163.com<白茶清欢>
Date : 10:00 下午 2021/7/24
func (*CatchHandler) NeedDeal ¶
func (ch *CatchHandler) NeedDeal() bool
NeedDeal 是否需要处理 : 存在异常切异常没有处理过
Author : go_developer@163.com<白茶清欢>
Date : 9:57 下午 2021/7/24
type FinalHandler ¶
type FinalHandler interface {
Finally(handlers ...func())
}
FinalHandler final处理
Author : go_developer@163.com<白茶清欢>
Date : 10:12 下午 2021/7/24
type ICatchHandler ¶
type ICatchHandler interface { Catch(e error, handler func(err error)) ICatchHandler CatchAll(handler func(err error)) FinalHandler FinalHandler }
ICatchHandler catch处理
Author : go_developer@163.com<白茶清欢>
Date : 10:12 下午 2021/7/24
func WithData ¶
func WithData(data easymap.EasyMap, f func(data easymap.EasyMap)) ICatchHandler
WithData 带数据的try
Author : go_developer@163.com<白茶清欢>
Date : 10:52 下午 2021/7/24
func WithGin ¶
func WithGin(ctx *gin.Context, f func(ctx *gin.Context)) ICatchHandler
WithGin 带 gin context 的 try, 可集成gin框架
Author : go_developer@163.com<白茶清欢>
Date : 10:50 下午 2021/7/24
func WithInterface ¶
func WithInterface(data interface{}, f func(data interface{})) ICatchHandler
WithInterface 传入任意数据类型
Author : go_developer@163.com<白茶清欢>
Date : 10:53 下午 2021/7/24
func WithNormal ¶
func WithNormal(f func()) ICatchHandler
WithNormal 入口try函数, 普通的逻辑
Author : go_developer@163.com<白茶清欢>
Date : 10:43 下午 2021/7/24
type SystemError ¶
type SystemError struct {
// contains filtered or unexported fields
}
SystemError 系统异常
Author : go_developer@163.com<白茶清欢>
Date : 11:35 下午 2021/7/24