Be less strict when reading metadata.
If the metadata table or the requested field is missing return null and allow the caller handle it.
This commit is contained in:
@@ -247,7 +247,9 @@ MBTiles.prototype._metadata = function(key, callback) {
|
||||
this._db.get('SELECT value FROM metadata WHERE name = ?',
|
||||
key,
|
||||
function(err, row) {
|
||||
if (!row || (err && err.errno == 1)) return callback(new Error('Key does not exist'));
|
||||
// If the metadata table or the requested field is missing return
|
||||
// null and allow the caller handle it.
|
||||
if (!row || (err && err.errno == 1)) return callback(null, null);
|
||||
else if (err) return callback(err);
|
||||
else return callback(null, row.value);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user