Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

display line error for "mapping value '%s' not a string" #174

Open
mayeulk opened this issue Sep 17, 2018 · 5 comments
Open

display line error for "mapping value '%s' not a string" #174

mayeulk opened this issue Sep 17, 2018 · 5 comments

Comments

@mayeulk
Copy link

mayeulk commented Sep 17, 2018

return fmt.Errorf("mapping value '%s' not a string", v)

With an ill-formed yml file, the error message being returned is sometimes as follows:
"mapping value '' not a string"
This is hard to debug. Adding some context (for instance: what is the key?) or, better, the line number, would help a lot.

@mayeulk
Copy link
Author

mayeulk commented Sep 17, 2018

Attached a settings/mapping.yml file (from my fork of the docker-osm project) which triggers such error
screenshot_20180917_mapping_value_not_a_string

@mayeulk
Copy link
Author

mayeulk commented Sep 17, 2018

mapping.yml.txt

mayeulk added a commit to mayeulk/docker-osm that referenced this issue Sep 17, 2018
In previous commit, some entries create an error, see: omniscale/imposm3#174
@Gustry
Copy link

Gustry commented Sep 17, 2018

So far, I think docker-OSM is using a copy from https://github.com/omniscale/imposm3/blob/master/example-mapping.yml

Could you try this one?

Maybe do a git diff after replacement to check if the version in Docker-OSM is more or less the same.

@mayeulk
Copy link
Author

mayeulk commented Sep 18, 2018

Thanks Etienne! I managed to create a correct file. THe issue I opened is about the fact that the error message is not informative, and could be improved. For instance, maybe the code could be modified so that the message
"mapping value '%s' not a string"
would be instead:
"mapping value '%s' (tied to mapping key '%t') not a string"
This would help a lot when the mapping value is displayed as an empty string in the message.

@Gustry
Copy link

Gustry commented Sep 18, 2018

Yes sure. It's still an issue upstream indeed. I was just trying to help you to overpass the current problem in your file in the meantime ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants