Skip to content

Commit f7c732f

Browse files
authored
docs: fixed incorrect onerror example (#1459)
1 parent 143d8f7 commit f7c732f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/api/response.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ app.use(async (ctx, next) => {
171171
const PassThrough = require('stream').PassThrough;
172172

173173
app.use(async ctx => {
174-
ctx.body = someHTTPStream.on('error', ctx.onerror).pipe(PassThrough());
174+
ctx.body = someHTTPStream.on('error', (err) => ctx.onerror(err)).pipe(PassThrough());
175175
});
176176
```
177177

0 commit comments

Comments
 (0)