How to use the level-errors.NotFoundError function in level-errors

To help you get started, we’ve selected a few level-errors examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github deanlandolt / bytespace / index.js View on Github external
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)
      }
    }
github maxogden / dat-core / index.js View on Github external
var notFound = function (key) {
  return new errors.NotFoundError('Key not found in database [' + key + ']')
}
github tradle / tim-old-engine / src / msgDB.js View on Github external
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())
      }
    })
  })
github smallhelm / level-fact-base / level-hash-index.js View on Github external
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);
        }
      });
    },
github tradle / tim-old-engine / lib / msgDB.js View on Github external
}), function (err, entries) {
      if (err) return cb(err)
      if (!entries || !entries.length) {
        return cb(new levelErrs.NotFoundError())
      }

      return cb(null, entries)
    })
  })
github tradle / engine / lib / indexer.js View on Github external
search(prop, value, function (err, results) {
        if (!err && !results.length) {
          err = new levelErrors.NotFoundError()
        }

        cb(err, results[0])
      })
    }
github dominictarr / level-sublevel / shell.js View on Github external
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)
    })
  }
github tradle / tim-old-engine / lib / msgDB.js View on Github external
function errWithNotFound (cb) {
  return cb(new levelErrs.NotFoundError())
}
github tradle / tim-old-engine / lib / typeDB.js View on Github external
function errWithNotFound (cb) {
  return cb(new levelErrs.NotFoundError())
}