Ambiguous error thrown when calling db.post with invalid params
- Dominant language
- JavaScript
- Stars
- 17.6k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
### 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. (/home/diana/projects/sandbox/node_modules/pouchdb-core/lib/index.js:373:16)
at klass. (/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 ()
at klass. (/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
Contributor guide
Assessment
This issue has not been assessed yet.