getInfo error not properly handled
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 540
- Forks
- 106
- PR merge metrics
- No merged PRs in 30d
Description
It appears that a failure in tilelive-bridge getInfo is not properly handled by tilelive.js.
You would think that https://github.com/mapbox/tilelive-bridge/blob/ae67f59b3e8e094c7b6a07597a76dbb073becd1f/index.js#L227 would trickle up and be handled cleanly but somehow instead an undefined `ts` is passed to https://github.com/mapbox/tilelive.js/blob/master/lib/tilelive.js#L293 causing an exception to be throw rather than an error returned. If this is expected behavior then perhaps we need a try/catch around `validate`?
Here is the exception [seen](https://travis-ci.org/mapbox/mapnik-swoop/jobs/68832520#L7086):
```
[Error: OGR Plugin: connection failed: /home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-omnivore/node_modules/mapnik-test-data/data/kml/1week_earthquake.kml was not found or is not a supported format encountered during parsing of layer 'Magnitude 6' in Layer]
at: Bridge. (/home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-bridge/index.js:227:25)
stack:
Error: OGR Plugin: connection failed: /home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-omnivore/node_modules/mapnik-test-data/data/kml/1week_earthquake.kml was not found or is not a supported format encountered during parsing of layer 'Magnitude 6' in Layer
...
/home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-omnivore/node_modules/tilelive/lib/tilelive.js:275
if ((typeof info.minzoom === 'number') && (typeof info.maxzoom === 'number
^
TypeError: Cannot read property 'minzoom' of undefined
at Object.tilelive.validate (/home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-omnivore/node_modules/tilelive/lib/tilelive.js:275:21)
at Object.tilelive.verify (/home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-omnivore/node_modules/tilelive/lib/tilelive.js:293:24)
at /home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-omnivore/test/index.js:54:26
at Bridge. (/home/travis/build/mapbox/mapnik-swoop/node_modules/tilelive-bridge/index.js:227:25)
at /home/travis/build/mapbox/mapnik-swoop/node_modules/generic-pool/lib/generic-pool.js:274:11
at loaded (/home/travis/build/mapbox/mapnik-swoop/node_modules/mapnik-pool/index.js:23:37)
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tilelive-bridge/index.js around line 227 and lib/tilelive.js around lines 275-293 to trace how the getInfo failure reaches validate through verify. Reproduce the missing KML failure from test/index.js line 54, then confirm the failure is returned as an error rather than causing an undefined-info exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100