-
Notifications
You must be signed in to change notification settings - Fork 0
/
errors.go
63 lines (56 loc) · 2.89 KB
/
errors.go
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2020 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package state
import (
"github.com/juju/errors"
"github.com/juju/mgo/v2/txn"
stateerrors "github.com/juju/juju/state/errors"
)
var (
newProviderIDNotUniqueError = stateerrors.NewProviderIDNotUniqueError
newParentDeviceHasChildrenError = stateerrors.NewParentDeviceHasChildrenError
newErrCharmAlreadyUploaded = stateerrors.NewErrCharmAlreadyUploaded
newHasAssignedUnitsError = stateerrors.NewHasAssignedUnitsError
newHasContainersError = stateerrors.NewHasContainersError
newHasAttachmentsError = stateerrors.NewHasAttachmentsError
newHasHostedModelsError = stateerrors.NewHasHostedModelsError
newHasPersistentStorageError = stateerrors.NewHasPersistentStorageError
newModelNotEmptyError = stateerrors.NewModelNotEmptyError
newStorageAttachedError = stateerrors.NewStorageAttachedError
newDeletedUserError = stateerrors.NewDeletedUserError
newNeverLoggedInError = stateerrors.NewNeverLoggedInError
newNeverConnectedError = stateerrors.NewNeverConnectedError
newVersionInconsistentError = stateerrors.NewVersionInconsistentError
IsCharmAlreadyUploadedError = stateerrors.IsCharmAlreadyUploadedError
IsProviderIDNotUniqueError = stateerrors.IsProviderIDNotUniqueError
IsParentDeviceHasChildrenError = stateerrors.IsParentDeviceHasChildrenError
IsIncompatibleSeriesError = stateerrors.IsIncompatibleSeriesError
IsNotAlive = stateerrors.IsNotAlive
IsHasAssignedUnitsError = stateerrors.IsHasAssignedUnitsError
IsHasContainersError = stateerrors.IsHasContainersError
IsHasAttachmentsError = stateerrors.IsHasAttachmentsError
IsHasHostedModelsError = stateerrors.IsHasHostedModelsError
IsHasPersistentStorageError = stateerrors.IsHasPersistentStorageError
IsModelNotEmptyError = stateerrors.IsModelNotEmptyError
IsStorageAttachedError = stateerrors.IsStorageAttachedError
IsDeletedUserError = stateerrors.IsDeletedUserError
IsNeverLoggedInError = stateerrors.IsNeverLoggedInError
IsNeverConnectedError = stateerrors.IsNeverConnectedError
IsVersionInconsistentError = stateerrors.IsVersionInconsistentError
)
var (
// State package internal errors.
machineNotAliveErr = stateerrors.NewNotAliveError("machine")
applicationNotAliveErr = stateerrors.NewNotAliveError("application")
unitNotAliveErr = stateerrors.NewNotAliveError("unit")
spaceNotAliveErr = stateerrors.NewNotAliveError("space")
subnetNotAliveErr = stateerrors.NewNotAliveError("subnet")
notAliveErr = stateerrors.NewNotAliveError("")
)
func onAbort(txnErr, err error) error {
if txnErr == txn.ErrAborted ||
errors.Cause(txnErr) == txn.ErrAborted {
return errors.Trace(err)
}
return errors.Trace(txnErr)
}