From d9d0d0e98ebcf68252aeebdadeda801dafb509b1 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 10 Jan 2018 09:48:21 -0800 Subject: [PATCH] doc: update pushStream docs to use err first Refs: https://github.com/nodejs/node/pull/17406#issuecomment-356661798 Backport-PR-URL: https://github.com/nodejs/node/pull/20456 PR-URL: https://github.com/nodejs/node/pull/18088 Reviewed-By: Anna Henningsen Reviewed-By: Matteo Collina Reviewed-By: Luigi Pinca Reviewed-By: Daniel Bevenius --- doc/api/http2.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/api/http2.md b/doc/api/http2.md index 2706f4cff3f5e2..e1ac74400b49f7 100644 --- a/doc/api/http2.md +++ b/doc/api/http2.md @@ -1174,14 +1174,16 @@ added: v8.4.0 * Returns: {undefined} Initiates a push stream. The callback is invoked with the new `Http2Stream` -instance created for the push stream. +instance created for the push stream passed as the second argument, or an +`Error` passed as the first argument. ```js const http2 = require('http2'); const server = http2.createServer(); server.on('stream', (stream) => { stream.respond({ ':status': 200 }); - stream.pushStream({ ':path': '/' }, (pushStream) => { + stream.pushStream({ ':path': '/' }, (err, pushStream) => { + if (err) throw err; pushStream.respond({ ':status': 200 }); pushStream.end('some pushed data'); });