github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/kubernetes/manifest/errors.go (about) 1 /* 2 Copyright 2020 The Skaffold Authors 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package manifest 18 19 import ( 20 "fmt" 21 22 sErrors "github.com/GoogleContainerTools/skaffold/pkg/skaffold/errors" 23 "github.com/GoogleContainerTools/skaffold/proto/v1" 24 ) 25 26 func replaceImageErr(err error) error { 27 return sErrors.NewError(err, 28 &proto.ActionableErr{ 29 Message: fmt.Sprintf("replacing images in manifest: %s", err), 30 ErrCode: proto.StatusCode_DEPLOY_REPLACE_IMAGE_ERR, 31 }) 32 } 33 34 func transformManifestErr(err error) error { 35 return sErrors.NewError(err, 36 &proto.ActionableErr{ 37 Message: fmt.Sprintf("unable to transform manifests: %s", err), 38 ErrCode: proto.StatusCode_DEPLOY_TRANSFORM_MANIFEST_ERR, 39 }) 40 } 41 42 func labelSettingErr(err error) error { 43 return sErrors.NewError(err, 44 &proto.ActionableErr{ 45 Message: fmt.Sprintf("setting labels in manifests: %s", err), 46 ErrCode: proto.StatusCode_DEPLOY_SET_LABEL_ERR, 47 }) 48 } 49 50 func parseImagesInManifestErr(err error) error { 51 if err == nil { 52 return err 53 } 54 return sErrors.NewError(err, 55 &proto.ActionableErr{ 56 Message: fmt.Sprintf("parsing images in manifests: %s", err), 57 ErrCode: proto.StatusCode_DEPLOY_PARSE_MANIFEST_IMAGES_ERR, 58 }) 59 } 60 61 func writeErr(err error) error { 62 return sErrors.NewError(err, 63 &proto.ActionableErr{ 64 Message: err.Error(), 65 ErrCode: proto.StatusCode_DEPLOY_MANIFEST_WRITE_ERR, 66 }) 67 }