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

Commit 473ed71

Browse files
committed
Reversed order for migration guide
1 parent fa70ba6 commit 473ed71

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

api-migration.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,28 @@ has breaking API changes. Each section covers migrating from one major version
55
to another. The section titles state the versions between which the change was
66
made.
77

8+
## 2.x → 3.x
9+
10+
We've upgraded our [nano](https://www.npmjs.com/package/nano) dependency. This
11+
means all return types are now a `Promise` (except for the `...AsStream`
12+
functions). The `promise` plugin is no longer required. It is silently ignored
13+
when specified in the client configuration.
14+
15+
Example:
16+
```js
17+
var cloudant = new Cloudant({ url: myUrl, plugins: [ 'retry' ] });
18+
19+
// Lists all the databases.
20+
cloudant.db.list().then((dbs) => {
21+
dbs.forEach((db) => {
22+
console.log(db);
23+
});
24+
}).catch((err) => { console.log(err); });
25+
```
26+
27+
Nano is responsible for resolving or rejecting all promises. Any errors thrown
28+
are created from within Nano. The old `CloudantError` type no longer exists.
29+
830
## 1.x → 2.x
931

1032
This change introduces multiple plugin support by using a request interceptor
@@ -49,25 +71,3 @@ var cloudant = new Cloudant({ url: myUrl, plugins: [] });
4971

5072
Finally, the `promise` plugin now throws a `CloudantError` (extended from
5173
`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)