github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/libnetwork/driverapi/errors.go (about) 1 package driverapi 2 3 import ( 4 "fmt" 5 ) 6 7 // ErrNoNetwork is returned if no network with the specified id exists 8 type ErrNoNetwork string 9 10 func (enn ErrNoNetwork) Error() string { 11 return fmt.Sprintf("No network (%s) exists", string(enn)) 12 } 13 14 // NotFound denotes the type of this error 15 func (enn ErrNoNetwork) NotFound() {} 16 17 // ErrEndpointExists is returned if more than one endpoint is added to the network 18 type ErrEndpointExists string 19 20 func (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 25 func (ee ErrEndpointExists) Forbidden() {} 26 27 // ErrNotImplemented is returned when a Driver has not implemented an API yet 28 type ErrNotImplemented struct{} 29 30 func (eni *ErrNotImplemented) Error() string { 31 return "The API is not implemented yet" 32 } 33 34 // NotImplemented denotes the type of this error 35 func (eni *ErrNotImplemented) NotImplemented() {} 36 37 // ErrNoEndpoint is returned if no endpoint with the specified id exists 38 type ErrNoEndpoint string 39 40 func (ene ErrNoEndpoint) Error() string { 41 return fmt.Sprintf("No endpoint (%s) exists", string(ene)) 42 } 43 44 // NotFound denotes the type of this error 45 func (ene ErrNoEndpoint) NotFound() {} 46 47 // ErrActiveRegistration represents an error when a driver is registered to a networkType that is previously registered 48 type ErrActiveRegistration string 49 50 // Error interface for ErrActiveRegistration 51 func (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 56 func (ar ErrActiveRegistration) Forbidden() {}