Add handling for err if tiles table does not exist.

This commit is contained in:
Young Hahn
2014-10-29 18:10:27 -04:00
parent cf72f04a70
commit 42b6a512b6

View File

@@ -29,6 +29,7 @@ function ZXYStream(source, options) {
ZXYStream.prototype._read = function() {
var stream = this;
this.source._db.all('SELECT zoom_level AS z, tile_column AS x, tile_row AS y FROM tiles LIMIT ' + this.batch + ' OFFSET ' + this.offset, function(err, rows) {
if (err && err.code === 'SQLITE_ERROR' && /no such table/.test(err.message)) return stream.push(null);
if (err) return stream.emit('error', err);
if (!rows.length) return stream.push(null);
stream.offset += stream.batch;