github.com/ssdev-go/moby@v17.12.1-ce-rc2+incompatible/plugin/errors.go (about)

     1  package plugin
     2  
     3  import "fmt"
     4  
     5  type errNotFound string
     6  
     7  func (name errNotFound) Error() string {
     8  	return fmt.Sprintf("plugin %q not found", string(name))
     9  }
    10  
    11  func (errNotFound) NotFound() {}
    12  
    13  type errAmbiguous string
    14  
    15  func (name errAmbiguous) Error() string {
    16  	return fmt.Sprintf("multiple plugins found for %q", string(name))
    17  }
    18  
    19  func (name errAmbiguous) InvalidParameter() {}
    20  
    21  type errDisabled string
    22  
    23  func (name errDisabled) Error() string {
    24  	return fmt.Sprintf("plugin %s found but disabled", string(name))
    25  }
    26  
    27  func (name errDisabled) Conflict() {}
    28  
    29  type validationError struct {
    30  	cause error
    31  }
    32  
    33  func (e validationError) Error() string {
    34  	return e.cause.Error()
    35  }
    36  
    37  func (validationError) Conflict() {}
    38  
    39  func (e validationError) Cause() error {
    40  	return e.cause
    41  }
    42  
    43  type systemError struct {
    44  	cause error
    45  }
    46  
    47  func (e systemError) Error() string {
    48  	return e.cause.Error()
    49  }
    50  
    51  func (systemError) SystemError() {}
    52  
    53  func (e systemError) Cause() error {
    54  	return e.cause
    55  }
    56  
    57  type invalidFilter struct {
    58  	filter string
    59  	value  []string
    60  }
    61  
    62  func (e invalidFilter) Error() string {
    63  	msg := "Invalid filter '" + e.filter
    64  	if len(e.value) > 0 {
    65  		msg += fmt.Sprintf("=%s", e.value)
    66  	}
    67  	return msg + "'"
    68  }
    69  
    70  func (invalidFilter) InvalidParameter() {}
    71  
    72  type inUseError string
    73  
    74  func (e inUseError) Error() string {
    75  	return "plugin " + string(e) + " is in use"
    76  }
    77  
    78  func (inUseError) Conflict() {}
    79  
    80  type enabledError string
    81  
    82  func (e enabledError) Error() string {
    83  	return "plugin " + string(e) + " is enabled"
    84  }
    85  
    86  func (enabledError) Conflict() {}
    87  
    88  type alreadyExistsError string
    89  
    90  func (e alreadyExistsError) Error() string {
    91  	return "plugin " + string(e) + " already exists"
    92  }
    93  
    94  func (alreadyExistsError) Conflict() {}