improve panic information when a catch-all wildcard conflict occurs (#1529)
This commit is contained in:
@@ -193,9 +193,16 @@ func (n *node) addRoute(path string, handlers HandlersChain) {
|
||||
}
|
||||
}
|
||||
|
||||
panic("path segment '" + path +
|
||||
pathSeg := path
|
||||
if n.nType != catchAll {
|
||||
pathSeg = strings.SplitN(path, "/", 2)[0]
|
||||
}
|
||||
prefix := fullPath[:strings.Index(fullPath, pathSeg)] + n.path
|
||||
panic("'" + pathSeg +
|
||||
"' in new path '" + fullPath +
|
||||
"' conflicts with existing wildcard '" + n.path +
|
||||
"' in path '" + fullPath + "'")
|
||||
"' in existing prefix '" + prefix +
|
||||
"'")
|
||||
}
|
||||
|
||||
c := path[0]
|
||||
|
||||
Reference in New Issue
Block a user