chore: refactor errors to use errors.Is (#3654)

This commit is contained in:
Kevin Wan
2023-10-21 00:00:57 +08:00
committed by GitHub
parent 81ae7d36b5
commit 42e0a6f90c
21 changed files with 90 additions and 53 deletions

View File

@@ -69,10 +69,10 @@ func (t *Tree) Add(route string, item any) error {
}
err := add(t.root, route[1:], item)
switch err {
case errDupItem:
switch {
case errors.Is(err, errDupItem):
return duplicatedItem(route)
case errDupSlash:
case errors.Is(err, errDupSlash):
return duplicatedSlash(route)
default:
return err