isle/go/daemon/errors.go
Brian Picciano 16aca610b4 Add multi-network support to daemon
It's still not possible to pick a network from the command-line, so this
is a bit broken, but the daemon component should handle it correctly at
least.
2024-09-23 19:04:14 +02:00

37 lines
1.1 KiB
Go

package daemon
import (
"isle/daemon/daecommon"
"isle/daemon/jsonrpc2"
)
const (
errCodeNoNetwork = daecommon.ErrorCodeRangeDaemon + iota
errCodeAlreadyJoined
errCodeNoMatchingNetworks
errCodeMultipleMatchingNetworks
)
var (
// ErrNoNetwork is returned when the daemon has never been configured with a
// network.
ErrNoNetwork = jsonrpc2.NewError(errCodeNoNetwork, "No network configured")
// ErrAlreadyJoined is returned when the daemon is instructed to create or
// join a new network, but it is already joined to that network.
ErrAlreadyJoined = jsonrpc2.NewError(errCodeAlreadyJoined, "Already joined to a network")
// 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",
)
)