From fa918df86d61c6a0f6e440d7b1bffa93a16af0ee Mon Sep 17 00:00:00 2001 From: Evan Lin Date: Fri, 6 Sep 2019 14:39:29 +0800 Subject: [PATCH] Fixed behaviour of boltdb routing table to return error when rule does not exist. --- pkg/routing/boltdb_routing_table.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/routing/boltdb_routing_table.go b/pkg/routing/boltdb_routing_table.go index 1e85ea6a9b..033a6da9cc 100644 --- a/pkg/routing/boltdb_routing_table.go +++ b/pkg/routing/boltdb_routing_table.go @@ -76,7 +76,9 @@ func (rt *boltDBRoutingTable) Rule(routeID RouteID) (Rule, error) { rule = b.Get(binaryID(routeID)) return nil }) - + if rule == nil { + return nil, fmt.Errorf("rule of routeID '%v' does not exist", routeID) + } return rule, err }