From f7c732fd06f724505e9090add4d977e667da55a8 Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Sat, 16 May 2020 11:33:29 +0300 Subject: [PATCH] docs: fixed incorrect onerror example (#1459) --- docs/api/response.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api/response.md b/docs/api/response.md index 4ad2f6631..d7c92ad8d 100644 --- a/docs/api/response.md +++ b/docs/api/response.md @@ -171,7 +171,7 @@ app.use(async (ctx, next) => { const PassThrough = require('stream').PassThrough; app.use(async ctx => { - ctx.body = someHTTPStream.on('error', ctx.onerror).pipe(PassThrough()); + ctx.body = someHTTPStream.on('error', (err) => ctx.onerror(err)).pipe(PassThrough()); }); ```