launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/environs/errors.go (about)

     1  // Copyright 2011, 2012, 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package environs
     5  
     6  import (
     7  	"errors"
     8  )
     9  
    10  var (
    11  	ErrNotBootstrapped  = errors.New("environment is not bootstrapped")
    12  	ErrNoInstances      = errors.New("no instances found")
    13  	ErrPartialInstances = errors.New("only some instances were found")
    14  )
    15  
    16  // containersUnsupportedError indicates that the environment does not support
    17  // creation of containers.
    18  type containersUnsupportedError struct {
    19  	msg string
    20  }
    21  
    22  func (e *containersUnsupportedError) Error() string {
    23  	return e.msg
    24  }
    25  
    26  // IsContainersUnsupportedError reports whether the error
    27  // was created by NewContainersUnsupportedError.
    28  func IsContainersUnsupportedError(err error) bool {
    29  	_, ok := err.(*containersUnsupportedError)
    30  	return ok
    31  }
    32  
    33  // NewContainersUnsupportedError returns a new error
    34  // which satisfies IsContainersUnsupported and reports
    35  // the given message.
    36  func NewContainersUnsupported(msg string) error {
    37  	return &containersUnsupportedError{msg: msg}
    38  }