package util import ( "errors" "net/http" ) var ( // ErrIPAM indicates an unsupported IPAM driver was used ErrIPAM = errors.New("only the null IPAM driver is supported") // ErrNoContainer indicates a container was unexpectedly not found ErrNoContainer = errors.New("couldn't find container by endpoint on the network") // ErrGuessFailed indicates that we guessed wrong the container and docker must re-try starting us ErrGuessFailed = errors.New("guessing of container failed containr must be re-created") ) func ErrToStatus(err error) int { switch { case errors.Is(err, ErrIPAM), errors.Is(err, ErrGuessFailed): return http.StatusBadRequest default: return http.StatusInternalServerError } }