Skip to content

Commit

Permalink
Merge pull request julienschmidt#74 from dlsniper/better-error-messages
Browse files Browse the repository at this point in the history
Better error messages
  • Loading branch information
julienschmidt committed Apr 8, 2015
2 parents 999ba04 + b6c5a22 commit 05f4293
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package httprouter
import (
"strings"
"unicode"
"fmt"
)

func min(a, b int) int {
Expand Down Expand Up @@ -147,7 +148,7 @@ func (n *node) addRoute(path string, handle Handle) {
}
}

panic("conflict with wildcard route")
panic(fmt.Sprintf("conflict with wildcard route. has %q got %q", path, n.path))
}

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

} 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
}
Expand Down

0 comments on commit 05f4293

Please sign in to comment.