koopjs / FeatureServer

An open source Geoservices Implementation (deprecated)
https://geoservices.github.io
Other
104 stars 32 forks source link

Can't get name of undefined #47

Closed ygalashov closed 6 years ago

ygalashov commented 6 years ago

Using koop-provider-sample when you hit /sample/FeatureServer this what you get:

{
    "error": "Cannot read property 'name' of undefined"
}

No logs are written to console and no easy way to find the reason, I had to use debugger and trace up to this: https://github.com/koopjs/FeatureServer/blob/7cabe2a63573fedb83ff4226e8e015b59d78cc35/src/info.js#L35-L48

40 name: geojson.metadata.name

You should provide defaults somewhere in the very beginning of the way (for example where router starts and receives geojson) and not to try to do it locally in every function, or use adequate getter like in lodash#get or ramda#path

dmfenton commented 6 years ago

Published in 2.4.6