变更 interface{} => any

This commit is contained in:
2024-06-08 20:06:35 +08:00
parent 3faebb9145
commit 588df729e0
13 changed files with 59 additions and 59 deletions

View File

@ -15,7 +15,7 @@ package try
type DefaultCatchHandler struct {
hasDeal bool // 异常是否已被处理
errCode string
data map[string]interface{}
data map[string]any
}
// hasDealError 判断异常是否已经被处理
@ -38,7 +38,7 @@ func (d *DefaultCatchHandler) hasDealError() bool {
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:19 2023/7/20
func (d *DefaultCatchHandler) Catch(errCode string, handler func(errCode string, data map[string]interface{})) ICatchHandler {
func (d *DefaultCatchHandler) Catch(errCode string, handler func(errCode string, data map[string]any)) ICatchHandler {
if d.hasDealError() {
return d
}
@ -61,7 +61,7 @@ func (d *DefaultCatchHandler) Catch(errCode string, handler func(errCode string,
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:47 2023/7/20
func (d *DefaultCatchHandler) CatchAll(handler func(errCode string, data map[string]interface{})) IFinalHandler {
func (d *DefaultCatchHandler) CatchAll(handler func(errCode string, data map[string]any)) IFinalHandler {
if d.hasDealError() {
return d
}
@ -80,9 +80,9 @@ func (d *DefaultCatchHandler) CatchAll(handler func(errCode string, data map[str
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:48 2023/7/20
func (d *DefaultCatchHandler) Finally(data map[string]interface{}, handlers ...func(data map[string]interface{})) {
func (d *DefaultCatchHandler) Finally(data map[string]any, handlers ...func(data map[string]any)) {
if data == nil {
data = map[string]interface{}{}
data = map[string]any{}
}
defer func() {
if r := recover(); nil != r {