core: Display invalid type in error message

If a variable type which is invalid (e.g. "stringg") is declared, we now
include the invalid type description in the error message to make it
easier to track down the source of the error in the source file.
This commit is contained in:
James Nugent 2016-01-25 10:21:12 -06:00
parent cb6cb8b96a
commit 3bdd1ac8b3
1 changed files with 1 additions and 1 deletions

View File

@ -807,7 +807,7 @@ func (v *Variable) ValidateTypeAndDefault() error {
// If an explicit type is declared, ensure it is valid // If an explicit type is declared, ensure it is valid
if v.DeclaredType != "" { if v.DeclaredType != "" {
if _, ok := typeStringMap[v.DeclaredType]; !ok { if _, ok := typeStringMap[v.DeclaredType]; !ok {
return fmt.Errorf("Variable '%s' must be of type string or map", v.Name) return fmt.Errorf("Variable '%s' must be of type string or map - '%s' is not a valid type", v.Name, v.DeclaredType)
} }
} }