github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/test/structure/error.go (about)

     1  /*
     2  Copyright 2021 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 structure
    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 containerStructureTestErr(err error) error {
    27  	return sErrors.NewError(err,
    28  		&proto.ActionableErr{
    29  			Message: fmt.Sprintf("running container-structure-test: %s", err),
    30  			ErrCode: proto.StatusCode_TEST_CST_USER_ERR,
    31  		},
    32  	)
    33  }
    34  
    35  func expandingFilePathsErr(err error) error {
    36  	return sErrors.NewError(err,
    37  		&proto.ActionableErr{
    38  			Message: fmt.Sprintf("expanding test file paths: %s", err),
    39  			ErrCode: proto.StatusCode_TEST_USER_CONFIG_ERR,
    40  		},
    41  	)
    42  }
    43  
    44  func dockerPullImageErr(fqn string, err error) error {
    45  	return sErrors.NewError(err,
    46  		&proto.ActionableErr{
    47  			Message: fmt.Sprintf("unable to docker pull image %s: %s", fqn, err),
    48  			ErrCode: proto.StatusCode_TEST_IMG_PULL_ERR,
    49  		},
    50  	)
    51  }