Skip to content

Commit

Permalink
core: Display invalid type in error message
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jen20 committed Jan 25, 2016
1 parent cb6cb8b commit 3bdd1ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ func (v *Variable) ValidateTypeAndDefault() error {
// If an explicit type is declared, ensure it is valid
if v.DeclaredType != "" {
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)
}
}

Expand Down

1 comment on commit 3bdd1ac

@phinze
Copy link
Contributor

@phinze phinze commented on 3bdd1ac Jan 25, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Please sign in to comment.