From 1665963ed7eb66f4a40ee12bdc94db2989beef83 Mon Sep 17 00:00:00 2001 From: Jason li Date: Sat, 23 Jan 2021 18:46:00 +0800 Subject: [PATCH] change panic message --- server/web/router.go | 2 +- server/web/router_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/web/router.go b/server/web/router.go index fba35aaf..e80694c0 100644 --- a/server/web/router.go +++ b/server/web/router.go @@ -576,7 +576,7 @@ func getReflectTypeAndMethod(f interface{}) (controllerType reflect.Type, method if len(method) == 0 { panic("method name is empty") } else if method[0] > 96 || method[0] < 65 { - panic("not a public method") + panic(fmt.Sprintf("%s is not a public method", method)) } // check only one param which is the method receiver diff --git a/server/web/router_test.go b/server/web/router_test.go index 7b8ebb6c..95ba77d1 100644 --- a/server/web/router_test.go +++ b/server/web/router_test.go @@ -961,7 +961,7 @@ func TestRouterAddRouterMethodPanicNotAMethod(t *testing.T) { func TestRouterAddRouterMethodPanicNotPublicMethod(t *testing.T) { method := http.MethodGet - message := "not a public method" + message := "ping is not a public method" defer func() { err := recover() if err != nil { //产生了panic异常