How to use the pouchdb-errors.BAD_REQUEST function in pouchdb-errors

To help you get started, we’ve selected a few pouchdb-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 colinskow / pouchdb-live-find / dist / pouchdb.live-find.js View on Github external
function tryFilter(filter, doc, req) {
  try {
    return !filter(doc, req);
  } catch (err) {
    var msg = 'Filter function threw: ' + err.toString();
    return pouchdbErrors.createError(pouchdbErrors.BAD_REQUEST, msg);
  }
}
github pouchdb-community / pouchdb-full-sync / lib / replicateWrapper.js View on Github external
'use strict';

var replicate = require('./replicate');
var Replication = require('./replication');
var clone = require('pouchdb-utils').clone;
var errors = require('pouchdb-errors');
var createError = errors.createError;
var BAD_REQUEST = errors.BAD_REQUEST;

function toPouch(db, opts) {
  var PouchConstructor = opts.PouchConstructor;
  if (typeof db === 'string') {
    return new PouchConstructor(db, opts);
  } else {
    return db;
  }
}

function replicateWrapper(src, target, opts, callback) {

  if (typeof opts === 'function') {
    callback = opts;
    opts = {};
  }