Skip to content

Commit d9d0d0e

Browse files
jasnellMylesBorins
authored andcommitted
doc: update pushStream docs to use err first
Refs: #17406 (comment) Backport-PR-URL: #20456 PR-URL: #18088 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent 3cd2054 commit d9d0d0e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/api/http2.md

+4-2
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)