Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit 90880db

Browse files
committed
Update api-migration.md
1 parent c135f49 commit 90880db

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

api-migration.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,25 @@ var cloudant = new Cloudant({ url: myUrl, plugins: [] });
4949

5050
Finally, the `promise` plugin now throws a `CloudantError` (extended from
5151
`Error`) rather than a `string` which was considered bad practice.
52+
53+
## 2.x → 3.x
54+
55+
We've upgraded our [nano](https://www.npmjs.com/package/nano) dependency. This
56+
means all return types are now a `Promise` (except for the `...AsStream`
57+
functions). The `promise` plugin is no longer required. It is silently ignored
58+
when specified in the client configuration.
59+
60+
Example:
61+
```js
62+
var cloudant = new Cloudant({ url: myUrl, plugins: [ 'retry' ] });
63+
64+
// Lists all the databases.
65+
cloudant.db.list().then((dbs) => {
66+
dbs.forEach((db) => {
67+
console.log(db);
68+
});
69+
}).catch((err) => { console.log(err); });
70+
```
71+
72+
Nano is responsible for resolving or rejecting all promises. Any errors thrown
73+
are created from within Nano. The old `CloudantError` type no longer exists.

0 commit comments

Comments
 (0)