github.com/oam-dev/kubevela@v1.9.11/pkg/utils/errors/reason.go (about) 1 /* 2 Copyright 2021 The KubeVela 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 errors 18 19 import ( 20 "strings" 21 ) 22 23 const ( 24 // LabelConflict defines the conflict label error string 25 LabelConflict = "LabelConflict" 26 ) 27 28 // IsLabelConflict checks if the error is Label Conflict error 29 func IsLabelConflict(err error) bool { 30 if err == nil { 31 return false 32 } 33 if strings.Contains(err.Error(), LabelConflict) { 34 return true 35 } 36 return false 37 } 38 39 // IsCuePathNotFound checks if the error is cue path not found error 40 func IsCuePathNotFound(err error) bool { 41 return strings.Contains(err.Error(), "failed to lookup value") && strings.Contains(err.Error(), "not exist") 42 }