How to use the couchbase.errors.keyNotFound function in couchbase

To help you get started, we’ve selected a few couchbase 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 cvent / lounge / lib / utils.js View on Github external
exports.isKeyNotFound = function isKeyNotFound (err) {
  let keyNotFound = false
  if (err) {
    if (err.code && err.code === errors.keyNotFound) {
      keyNotFound = true
    } else if (err.message && err.message === 'key not found') {
      keyNotFound = true
    } else if (err.message && err.message.indexOf('key does not exist') >= 0) {
      keyNotFound = true
    } else if (err.message && err.message.indexOf('key not found') >= 0) {
      keyNotFound = true
    } else if (err.code && err.code.toString() === '13') {
      keyNotFound = true
    }
  }

  return keyNotFound
}