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:
parent
cb6cb8b96a
commit
3bdd1ac8b3
|
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue