OLD | NEW |
1 // Copyright 2013 Canonical Ltd. | 1 // Copyright 2013 Canonical Ltd. |
2 // Licensed under the AGPLv3, see LICENCE file for details. | 2 // Licensed under the AGPLv3, see LICENCE file for details. |
3 | 3 |
4 package testing | 4 package testing |
5 | 5 |
6 import ( | 6 import ( |
7 "fmt" | 7 "fmt" |
8 | 8 |
9 "launchpad.net/juju-core/state/api/params" | 9 "launchpad.net/juju-core/state/api/params" |
10 ) | 10 ) |
(...skipping 17 matching lines...) Expand all Loading... |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 func NotAssignedError(unitName string) *params.Error { | 31 func NotAssignedError(unitName string) *params.Error { |
32 return ¶ms.Error{ | 32 return ¶ms.Error{ |
33 Message: fmt.Sprintf("unit %q is not assigned to a machine", uni
tName), | 33 Message: fmt.Sprintf("unit %q is not assigned to a machine", uni
tName), |
34 Code: params.CodeNotAssigned, | 34 Code: params.CodeNotAssigned, |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
| 38 func AlreadyExistsError(what string) *params.Error { |
| 39 return ¶ms.Error{ |
| 40 Message: fmt.Sprintf("%s already exists", what), |
| 41 Code: params.CodeAlreadyExists, |
| 42 } |
| 43 } |
| 44 |
38 func ServerError(message string) *params.Error { | 45 func ServerError(message string) *params.Error { |
39 return ¶ms.Error{ | 46 return ¶ms.Error{ |
40 Message: message, | 47 Message: message, |
41 Code: "", | 48 Code: "", |
42 } | 49 } |
43 } | 50 } |
44 | 51 |
45 func PrefixedError(prefix, message string) *params.Error { | 52 func PrefixedError(prefix, message string) *params.Error { |
46 return ServerError(prefix + message) | 53 return ServerError(prefix + message) |
47 } | 54 } |
OLD | NEW |