mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 18:10:54 +00:00
method name refactor
This commit is contained in:
parent
cc5abc6b30
commit
0ac690d2c8
9
error.go
9
error.go
@ -376,13 +376,14 @@ func ErrorController(c ControllerInterface) *App {
|
|||||||
rt := reflectVal.Type()
|
rt := reflectVal.Type()
|
||||||
ct := reflect.Indirect(reflectVal).Type()
|
ct := reflect.Indirect(reflectVal).Type()
|
||||||
for i := 0; i < rt.NumMethod(); i++ {
|
for i := 0; i < rt.NumMethod(); i++ {
|
||||||
if !utils.InSlice(rt.Method(i).Name, exceptMethod) && strings.HasPrefix(rt.Method(i).Name, "Error") {
|
methodName := rt.Method(i).Name
|
||||||
|
if !utils.InSlice(methodName, exceptMethod) && strings.HasPrefix(methodName, "Error") {
|
||||||
errinfo := &errorInfo{}
|
errinfo := &errorInfo{}
|
||||||
errinfo.errorType = errorTypeController
|
errinfo.errorType = errorTypeController
|
||||||
errinfo.controllerType = ct
|
errinfo.controllerType = ct
|
||||||
errinfo.method = rt.Method(i).Name
|
errinfo.method = methodName
|
||||||
errname := strings.TrimPrefix(rt.Method(i).Name, "Error")
|
errName := strings.TrimPrefix(methodName, "Error")
|
||||||
ErrorMaps[errname] = errinfo
|
ErrorMaps[errName] = errinfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return BeeApp
|
return BeeApp
|
||||||
|
Loading…
Reference in New Issue
Block a user