Disable router when a rule has an error
This commit is contained in:
parent
ac8e47579b
commit
63f65e5b2a
3 changed files with 41 additions and 1 deletions
|
@ -59,7 +59,14 @@ func (r *Router) AddRoute(rule string, priority int, handler http.Handler) error
|
|||
}
|
||||
|
||||
route := r.NewRoute().Handler(handler).Priority(priority)
|
||||
return addRuleOnRoute(route, buildTree())
|
||||
|
||||
err = addRuleOnRoute(route, buildTree())
|
||||
if err != nil {
|
||||
route.BuildOnly()
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type tree struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue