Better logging messages

This commit is contained in:
Yann Hamon 2020-05-31 04:27:18 +02:00
parent ae5fbffb95
commit 11cfca1498
4 changed files with 20 additions and 11 deletions

View file

@ -46,7 +46,14 @@ func Validate(rawResource []byte, schema *gojsonschema.Schema) error {
}
if !results.Valid() {
return InvalidResourceError{err: fmt.Sprintf("resource does not conform to schema: %+v", results)}
msg := ""
for _, errMsg := range results.Errors() {
if msg != "" {
msg += " - "
}
msg += errMsg.Description()
}
return InvalidResourceError{err: msg}
}
return nil