1package driverapi
2
3import (
4	"fmt"
5)
6
7// ErrNoNetwork is returned if no network with the specified id exists
8type ErrNoNetwork string
9
10func (enn ErrNoNetwork) Error() string {
11	return fmt.Sprintf("No network (%s) exists", string(enn))
12}
13
14// NotFound denotes the type of this error
15func (enn ErrNoNetwork) NotFound() {}
16
17// ErrEndpointExists is returned if more than one endpoint is added to the network
18type ErrEndpointExists string
19
20func (ee ErrEndpointExists) Error() string {
21	return fmt.Sprintf("Endpoint (%s) already exists (Only one endpoint allowed)", string(ee))
22}
23
24// Forbidden denotes the type of this error
25func (ee ErrEndpointExists) Forbidden() {}
26
27// ErrNotImplemented is returned when a Driver has not implemented an API yet
28type ErrNotImplemented struct{}
29
30func (eni *ErrNotImplemented) Error() string {
31	return "The API is not implemented yet"
32}
33
34// NotImplemented denotes the type of this error
35func (eni *ErrNotImplemented) NotImplemented() {}
36
37// ErrNoEndpoint is returned if no endpoint with the specified id exists
38type ErrNoEndpoint string
39
40func (ene ErrNoEndpoint) Error() string {
41	return fmt.Sprintf("No endpoint (%s) exists", string(ene))
42}
43
44// NotFound denotes the type of this error
45func (ene ErrNoEndpoint) NotFound() {}
46
47// ErrActiveRegistration represents an error when a driver is registered to a networkType that is previously registered
48type ErrActiveRegistration string
49
50// Error interface for ErrActiveRegistration
51func (ar ErrActiveRegistration) Error() string {
52	return fmt.Sprintf("Driver already registered for type %q", string(ar))
53}
54
55// Forbidden denotes the type of this error
56func (ar ErrActiveRegistration) Forbidden() {}
57