From 42b6a512b67b80cb0f1f3a0136b4fa26e270f401 Mon Sep 17 00:00:00 2001 From: Young Hahn Date: Wed, 29 Oct 2014 18:10:27 -0400 Subject: [PATCH] Add handling for err if tiles table does not exist. --- lib/zxystream.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/zxystream.js b/lib/zxystream.js index 7be72cf..654c2e5 100644 --- a/lib/zxystream.js +++ b/lib/zxystream.js @@ -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;