Skip to content

Commit 05f4293

Browse files
committed
Merge pull request #74 from dlsniper/better-error-messages
Better error messages
2 parents 999ba04 + b6c5a22 commit 05f4293

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tree.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package httprouter
77
import (
88
"strings"
99
"unicode"
10+
"fmt"
1011
)
1112

1213
func min(a, b int) int {
@@ -147,7 +148,7 @@ func (n *node) addRoute(path string, handle Handle) {
147148
}
148149
}
149150

150-
panic("conflict with wildcard route")
151+
panic(fmt.Sprintf("conflict with wildcard route. has %q got %q", path, n.path))
151152
}
152153

153154
c := path[0]
@@ -184,7 +185,7 @@ func (n *node) addRoute(path string, handle Handle) {
184185

185186
} else if i == len(path) { // Make node a (in-path) leaf
186187
if n.handle != nil {
187-
panic("a Handle is already registered for this path")
188+
panic(fmt.Sprintf("a Handle is already registered for this path (%q)", path))
188189
}
189190
n.handle = handle
190191
}

0 commit comments

Comments
 (0)