koajs / koajs/error

stream error

Open
#11 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
103
Forks
32
PR merge metrics
No merged PRs in 30d

Description

we only do `try catch` here to catch the error.
but all the streams' and events' errors are handling by `stream.on('error', this.onerror)`, we can do nothing for them, except hack `ctx.onerror` method.

should we add an easy way for users to write their own error handler in koa, just like what connect/express do:

```
app.use(function (err, req, res, next){});
```

or just leave these to error middleware with hack `ctx.onerror`?

Contributor guide

Open the contributing guide

Research direction

Start by tracing the Koa error middleware and the stream.on('error', this.onerror) path mentioned in the issue, including how ctx.onerror is currently used. The issue names no files or tests, so first identify the relevant entry points and existing error-handling coverage. Done requires a decided, documented approach for user-defined handling of stream and event errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.