How to use the levelup/lib/errors.NotFoundError function in levelup

To help you get started, we’ve selected a few levelup 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 brycebaril / level-version / index.js View on Github external
function collect(records) {
      if (!records || !records.length) {
        return cb(new NotFoundError("Key not found in database [" + key + "]"))
      }
      var r = records[0]
      // TODO other options?
      if (options && options.valueEncoding == "json") r.value = JSON.parse(r.value)
      return cb(null, r.value, r.version)
    }

levelup

Fast & simple storage - a Node.js-style LevelDB wrapper

MIT
Latest version published 3 years ago

Package Health Score

79 / 100
Full package analysis