1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 11:50:55 +00:00

method name refactor

This commit is contained in:
JessonChan 2015-09-18 17:59:28 +08:00
parent cc5abc6b30
commit 0ac690d2c8

View File

@ -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