File: errors.go

package info (click to toggle)
docker.io 28.5.2%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 69,048 kB
  • sloc: sh: 5,867; makefile: 863; ansic: 184; python: 162; asm: 159
file content (46 lines) | stat: -rw-r--r-- 1,312 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//go:build linux

package bridge

import (
	"errors"
	"fmt"

	"github.com/docker/docker/errdefs"
)

// errInvalidGateway is returned when the user provided default gateway (v4/v6) is not valid.
var errInvalidGateway = errdefs.InvalidParameter(errors.New("default gateway ip must be part of the network"))

// invalidNetworkIDError is returned when the passed
// network id for an existing network is not a known id.
type invalidNetworkIDError string

func (e invalidNetworkIDError) Error() string {
	return fmt.Sprintf("invalid network id %s", string(e))
}

// NotFound denotes the type of this error
func (e invalidNetworkIDError) NotFound() {}

// invalidEndpointIDError is returned when the passed
// endpoint id is not valid.
type invalidEndpointIDError string

func (e invalidEndpointIDError) Error() string {
	return fmt.Sprintf("invalid endpoint id: %s", string(e))
}

// InvalidParameter denotes the type of this error
func (e invalidEndpointIDError) InvalidParameter() {}

// endpointNotFoundError is returned when the no endpoint
// with the passed endpoint id is found.
type endpointNotFoundError string

func (e endpointNotFoundError) Error() string {
	return fmt.Sprintf("endpoint not found: %s", string(e))
}

// NotFound denotes the type of this error
func (e endpointNotFoundError) NotFound() {}