Add handling for err if tiles table does not exist.
This commit is contained in:
@@ -29,6 +29,7 @@ function ZXYStream(source, options) {
|
|||||||
ZXYStream.prototype._read = function() {
|
ZXYStream.prototype._read = function() {
|
||||||
var stream = this;
|
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) {
|
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 (err) return stream.emit('error', err);
|
||||||
if (!rows.length) return stream.push(null);
|
if (!rows.length) return stream.push(null);
|
||||||
stream.offset += stream.batch;
|
stream.offset += stream.batch;
|
||||||
|
|||||||
Reference in New Issue
Block a user