forward zlib decompression errors instead of failing hard
This commit is contained in:
@@ -231,6 +231,8 @@ MBTiles.prototype.grid = function(x, y, z, callback) {
|
||||
function(err, row, rows) {
|
||||
if (err) return callback(err);
|
||||
if (!row || !row.grid) return callback('Grid does not exist');
|
||||
|
||||
try {
|
||||
var grid = zlib.inflate(
|
||||
!Buffer.isBuffer(row.grid)
|
||||
? new Buffer(row.grid, 'binary')
|
||||
@@ -241,6 +243,9 @@ MBTiles.prototype.grid = function(x, y, z, callback) {
|
||||
return memo;
|
||||
}, {});
|
||||
callback(null, _(JSON.parse(grid)).extend({ data: data }));
|
||||
} catch(err) {
|
||||
callback(err);
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user