launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/state/apiserver/testing/errors.go (about) 1 // Copyright 2013 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package testing 5 6 import ( 7 "fmt" 8 "launchpad.net/juju-core/state/api/params" 9 ) 10 11 var ErrUnauthorized = ¶ms.Error{ 12 Message: "permission denied", 13 Code: params.CodeUnauthorized, 14 } 15 16 func NotFoundError(prefixMessage string) *params.Error { 17 return ¶ms.Error{ 18 Message: fmt.Sprintf("%s not found", prefixMessage), 19 Code: params.CodeNotFound, 20 } 21 } 22 23 func NotProvisionedError(machineId string) *params.Error { 24 return ¶ms.Error{ 25 Message: fmt.Sprintf("machine %s is not provisioned", machineId), 26 Code: params.CodeNotProvisioned, 27 } 28 } 29 30 func NotAssignedError(unitName string) *params.Error { 31 return ¶ms.Error{ 32 Message: fmt.Sprintf("unit %q is not assigned to a machine", unitName), 33 Code: params.CodeNotAssigned, 34 } 35 } 36 37 func ServerError(message string) *params.Error { 38 return ¶ms.Error{ 39 Message: message, 40 Code: "", 41 } 42 }