hook 静默方式运行,失败打印错误日志
This commit is contained in:
parent
8ba5a624ae
commit
c7068102de
1 changed files with 13 additions and 3 deletions
|
|
@ -161,13 +161,18 @@ func (table *Table) Before(process string, processArgs []interface{}) []interfac
|
||||||
res = append(res, processArgs[0])
|
res = append(res, processArgs[0])
|
||||||
}
|
}
|
||||||
|
|
||||||
response := gou.NewProcess(process, args...).Run()
|
response, err := gou.NewProcess(process, args...).Exec()
|
||||||
|
if err != nil {
|
||||||
|
xlog.Println("Hook执行失败: ", err.Error(), maps.StrAny{"process": process, "args": args})
|
||||||
|
return processArgs
|
||||||
|
}
|
||||||
|
|
||||||
if fixedArgs, ok := response.([]interface{}); ok {
|
if fixedArgs, ok := response.([]interface{}); ok {
|
||||||
res = append(res, fixedArgs...)
|
res = append(res, fixedArgs...)
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
xlog.Println("无效的处理器", maps.StrAny{"process": process, "response": response})
|
xlog.Println("Hook执行失败: 无效的处理器", maps.StrAny{"process": process, "response": response})
|
||||||
return processArgs
|
return processArgs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,7 +181,12 @@ func (table *Table) After(process string, data interface{}) interface{} {
|
||||||
if process == "" {
|
if process == "" {
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
return gou.NewProcess(process, data).Run()
|
response, err := gou.NewProcess(process, data).Exec()
|
||||||
|
if err != nil {
|
||||||
|
xlog.Println("Hook执行失败: ", err.Error(), maps.StrAny{"process": process, "data": data})
|
||||||
|
return data
|
||||||
|
}
|
||||||
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
// loadFilters 加载查询过滤器
|
// loadFilters 加载查询过滤器
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue