Get rid of dynamic errors

This commit is contained in:
Kristoffer Dalby 2021-11-15 19:18:14 +00:00
parent 25b790d025
commit d6739386a0
No known key found for this signature in database
GPG key ID: 09F62DC067465735
10 changed files with 53 additions and 22 deletions

View file

@ -2,12 +2,15 @@ package headscale
import (
"encoding/json"
"fmt"
"gorm.io/datatypes"
"inet.af/netaddr"
)
const (
errRouteIsNotAvailable = Error("route is not available")
)
// Deprecated: use machine function instead
// GetAdvertisedNodeRoutes returns the subnet routes advertised by a node (identified by
// namespace and node name).
@ -129,7 +132,7 @@ func (h *Headscale) EnableNodeRoute(
}
if !available {
return fmt.Errorf("route (%s) is not available on node %s", nodeName, routeStr)
return errRouteIsNotAvailable
}
routes, err := json.Marshal(enabledRoutes)