github.com/RedHatInsights/insights-content-service@v1.0.0/content/errors.go (about) 1 /* 2 Copyright © 2020 Red Hat, Inc. 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 content contains logic for parsing rule content. 18 package content 19 20 import "fmt" 21 22 // MissingMandatoryFile is an error raised while parsing, when a mandatory file is missing 23 type MissingMandatoryFile struct { 24 FileName string 25 } 26 27 // InvalidItem is an error raised when unexpected type is found when parsing 28 type InvalidItem struct { 29 FileName string 30 KeyName string 31 } 32 33 func (err MissingMandatoryFile) Error() string { 34 return fmt.Sprintf("Missing required file: %s", err.FileName) 35 } 36 37 func (err InvalidItem) Error() string { 38 return fmt.Sprintf("Invalid item `%s` in file %s", err.KeyName, err.FileName) 39 }