change panic message
This commit is contained in:
parent
4077b6fdf0
commit
1665963ed7
@ -576,7 +576,7 @@ func getReflectTypeAndMethod(f interface{}) (controllerType reflect.Type, method
|
|||||||
if len(method) == 0 {
|
if len(method) == 0 {
|
||||||
panic("method name is empty")
|
panic("method name is empty")
|
||||||
} else if method[0] > 96 || method[0] < 65 {
|
} 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
|
// check only one param which is the method receiver
|
||||||
|
|||||||
@ -961,7 +961,7 @@ func TestRouterAddRouterMethodPanicNotAMethod(t *testing.T) {
|
|||||||
|
|
||||||
func TestRouterAddRouterMethodPanicNotPublicMethod(t *testing.T) {
|
func TestRouterAddRouterMethodPanicNotPublicMethod(t *testing.T) {
|
||||||
method := http.MethodGet
|
method := http.MethodGet
|
||||||
message := "not a public method"
|
message := "ping is not a public method"
|
||||||
defer func() {
|
defer func() {
|
||||||
err := recover()
|
err := recover()
|
||||||
if err != nil { //产生了panic异常
|
if err != nil { //产生了panic异常
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user