2024-06-24 16:55:36 +00:00
|
|
|
package daemon
|
|
|
|
|
2024-09-09 14:34:00 +00:00
|
|
|
import (
|
|
|
|
"isle/daemon/daecommon"
|
|
|
|
"isle/daemon/jsonrpc2"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
errCodeNoNetwork = daecommon.ErrorCodeRangeDaemon + iota
|
|
|
|
errCodeAlreadyJoined
|
2024-09-23 17:04:14 +00:00
|
|
|
errCodeNoMatchingNetworks
|
|
|
|
errCodeMultipleMatchingNetworks
|
2024-11-09 20:13:33 +00:00
|
|
|
errCodeUserManagedNetworkConfig
|
2024-09-09 14:34:00 +00:00
|
|
|
)
|
2024-06-24 16:55:36 +00:00
|
|
|
|
|
|
|
var (
|
2024-07-07 10:44:49 +00:00
|
|
|
// ErrNoNetwork is returned when the daemon has never been configured with a
|
|
|
|
// network.
|
2024-09-09 14:34:00 +00:00
|
|
|
ErrNoNetwork = jsonrpc2.NewError(errCodeNoNetwork, "No network configured")
|
2024-06-24 16:55:36 +00:00
|
|
|
|
2024-07-07 10:44:49 +00:00
|
|
|
// ErrAlreadyJoined is returned when the daemon is instructed to create or
|
2024-09-23 17:04:14 +00:00
|
|
|
// join a new network, but it is already joined to that network.
|
2024-09-09 14:34:00 +00:00
|
|
|
ErrAlreadyJoined = jsonrpc2.NewError(errCodeAlreadyJoined, "Already joined to a network")
|
2024-09-23 17:04:14 +00:00
|
|
|
|
|
|
|
// ErrNoMatchingNetworks is returned if the search string didn't match any
|
|
|
|
// networks.
|
|
|
|
ErrNoMatchingNetworks = jsonrpc2.NewError(
|
|
|
|
errCodeNoMatchingNetworks, "No networks matched the search string",
|
|
|
|
)
|
|
|
|
|
|
|
|
// ErrMultipleMatchingNetworks is returned if the search string matched
|
|
|
|
// multiple networks.
|
|
|
|
ErrMultipleMatchingNetworks = jsonrpc2.NewError(
|
|
|
|
errCodeMultipleMatchingNetworks,
|
|
|
|
"Multiple networks matched the search string",
|
|
|
|
)
|
2024-11-09 20:13:33 +00:00
|
|
|
|
|
|
|
// ErrUserManagedNetworkConfig is returned when attempting to modify a
|
|
|
|
// network config which is managed by the user.
|
|
|
|
ErrUserManagedNetworkConfig = jsonrpc2.NewError(
|
|
|
|
errCodeUserManagedNetworkConfig,
|
|
|
|
"Network configuration is managed by the user",
|
|
|
|
)
|
2024-06-24 16:55:36 +00:00
|
|
|
)
|