Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function handler(err, v) {
// sanitize full keypath for notFound errors
if (err && err.notFound || NOT_FOUND.test(err)) {
try {
err = new NotFoundError('Key not found in database [' + k + ']')
}
catch (_) {}
}
cb(err, v)
}
}
var notFound = function (key) {
return new errors.NotFoundError('Key not found in database [' + key + ']')
}
return db.byRootHash(rootHash, function (err, entries) {
if (err) return cb(err)
var found = entries.some(function (e) {
if (e[CUR_HASH] === curHash) {
cb(null, e)
}
})
if (!found) {
cb(null, new levelErrs.NotFoundError())
}
})
})
put(val, function(err, d){
if(err){
callback(err);
}else if(d.is_new){
callback(new NotFoundError("No hash exists for that value"));
}else{
callback(null, d.hash);
}
});
},
}), function (err, entries) {
if (err) return cb(err)
if (!entries || !entries.length) {
return cb(new levelErrs.NotFoundError())
}
return cb(null, entries)
})
})
search(prop, value, function (err, results) {
if (!err && !results.length) {
err = new levelErrors.NotFoundError()
}
cb(err, results[0])
})
}
nut.get(key, prefix, mergeOpts(opts), function (err, value) {
if(err) cb(new errors.NotFoundError('Key not found in database', err))
else cb(null, value)
})
}
function errWithNotFound (cb) {
return cb(new levelErrs.NotFoundError())
}
function errWithNotFound (cb) {
return cb(new levelErrs.NotFoundError())
}