Skip to content

Commit f7c732f

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

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

docs/api/response.md

Lines changed: 1 addition & 1 deletion
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)