Merge pull request #74 from dlsniper/better-error-messages
Better error messages
diff --git a/tree.go b/tree.go
index b9d51e4..b741654 100644
--- a/tree.go
+++ b/tree.go
@@ -7,6 +7,7 @@
import (
"strings"
"unicode"
+ "fmt"
)
func min(a, b int) int {
@@ -147,7 +148,7 @@
}
}
- panic("conflict with wildcard route")
+ panic(fmt.Sprintf("conflict with wildcard route. has %q got %q", path, n.path))
}
c := path[0]
@@ -184,7 +185,7 @@
} else if i == len(path) { // Make node a (in-path) leaf
if n.handle != nil {
- panic("a Handle is already registered for this path")
+ panic(fmt.Sprintf("a Handle is already registered for this path (%q)", path))
}
n.handle = handle
}