Skip to content

Commit 17ee4c5

Browse files
committed
doc: update pushStream docs to use err first
Refs: #17406 (comment)
1 parent 7c84f19 commit 17ee4c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/api/http2.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,14 +1174,16 @@ added: v8.4.0
11741174
* Returns: {undefined}
11751175

11761176
Initiates a push stream. The callback is invoked with the new `Http2Stream`
1177-
instance created for the push stream.
1177+
instance created for the push stream passed as the second argument, or an
1178+
`Error` passed as the first argument.
11781179

11791180
```js
11801181
const http2 = require('http2');
11811182
const server = http2.createServer();
11821183
server.on('stream', (stream) => {
11831184
stream.respond({ ':status': 200 });
1184-
stream.pushStream({ ':path': '/' }, (pushStream) => {
1185+
stream.pushStream({ ':path': '/' }, (err, pushStream) => {
1186+
if (err) throw err;
11851187
pushStream.respond({ ':status': 200 });
11861188
pushStream.end('some pushed data');
11871189
});

0 commit comments

Comments
 (0)