Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous error thrown when calling db.post with invalid params #8937

Open
dianabarsan opened this issue Apr 23, 2024 · 0 comments
Open

Ambiguous error thrown when calling db.post with invalid params #8937

dianabarsan opened this issue Apr 23, 2024 · 0 comments

Comments

@dianabarsan
Copy link
Contributor

dianabarsan commented Apr 23, 2024

Issue

Calling db.post with invalid arguments will throw an ambiguous error:

/usr/bin/node /home/diana/projects/sandbox/pouch-post.js
/home/diana/projects/sandbox/node_modules/pouchdb-core/lib/index.js:373
        return callback(pouchdbErrors.createError(pouchdbErrors.NOT_AN_OBJECT));
               ^

TypeError: callback is not a function
    at klass.<anonymous> (/home/diana/projects/sandbox/node_modules/pouchdb-core/lib/index.js:373:16)
    at klass.<anonymous> (/home/diana/projects/sandbox/node_modules/pouchdb-utils/lib/index.js:177:21)
    at /home/diana/projects/sandbox/node_modules/pouchdb-utils/lib/index.js:116:21
    at new Promise (<anonymous>)
    at klass.<anonymous> (/home/diana/projects/sandbox/node_modules/pouchdb-utils/lib/index.js:103:19)
    at /home/diana/projects/sandbox/node_modules/pouchdb-utils/lib/index.js:172:32
    at TaskQueue.execute (/home/diana/projects/sandbox/node_modules/pouchdb-core/lib/index.js:1209:9)
    at TaskQueue.ready (/home/diana/projects/sandbox/node_modules/pouchdb-core/lib/index.js:1222:10)
    at /home/diana/projects/sandbox/node_modules/pouchdb-core/lib/index.js:1386:22
    at /home/diana/projects/sandbox/node_modules/pouchdb-adapter-leveldb-core/lib/index.js:277:15

Node.js v18.18.2

Reproduce

const PouchDb = require('pouchdb-core');
PouchDb.plugin(require('pouchdb-adapter-memory')); // adapter is irrelevant

const db = PouchDb('database');
db.post();

Info

  • Environment: Node 18
  • Platform: NodeJS
  • Adapter: memory/http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant