~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/worker/uniter/operation/errors.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2014 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package operation
 
5
 
 
6
import (
 
7
        "fmt"
 
8
 
 
9
        "github.com/juju/errors"
 
10
        corecharm "gopkg.in/juju/charm.v6-unstable"
 
11
)
 
12
 
 
13
var (
 
14
        ErrNoStateFile            = errors.New("uniter state file does not exist")
 
15
        ErrSkipExecute            = errors.New("operation already executed")
 
16
        ErrNeedsReboot            = errors.New("reboot request issued")
 
17
        ErrHookFailed             = errors.New("hook failed")
 
18
        ErrCannotAcceptLeadership = errors.New("cannot accept leadership")
 
19
)
 
20
 
 
21
type deployConflictError struct {
 
22
        charmURL *corecharm.URL
 
23
}
 
24
 
 
25
func (err *deployConflictError) Error() string {
 
26
        return fmt.Sprintf("cannot deploy charm %s", err.charmURL)
 
27
}
 
28
 
 
29
// NewDeployConflictError returns an error indicating that the charm with
 
30
// the supplied URL failed to deploy.
 
31
func NewDeployConflictError(charmURL *corecharm.URL) error {
 
32
        return &deployConflictError{charmURL}
 
33
}
 
34
 
 
35
// IsDeployConflictError returns true if the error is a
 
36
// deploy conflict error.
 
37
func IsDeployConflictError(err error) bool {
 
38
        _, ok := err.(*deployConflictError)
 
39
        return ok
 
40
}