mapbox/tilelive

getInfo error not properly handled

springmeyer opened this issue · 0 comments

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:

      [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.<anonymous> (/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.<anonymous> (/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)