Comments (5)
how about we remove app.outputErrors (and just imply that stuff in the default handler), and make it app.error(fn)
so that you can easily override it without manually removing one or all or some of the listeners, but at least then it's still "batteries included"
from koa.
something like:
function App() {
this.on('error', logger);
}
App.prototype.error = function(fn){
this.removeListener('error', logger);
this.on('error', fn);
}
function logger(err) {
if ('test' != this.env) console.error(err.stack);
}
i think that'll work. remember, no .bind(this)
necessary in node! haha
from koa.
yeah I think that'll work pretty good, and we can forward mounted app errors upstream
from koa.
think im fine with this for now actually, it's easier to explain app.outputErrors = false
than if you call app.error() it overrides it, and you can add additional listeners with "error" etc blha blah. Plus IMHO you always want stderr traces, never know when other forms of reporting may fail
from koa.
haha, so i thought about errors where you don't want them to be logged, but then i realized how much easier error handling will be vs express
from koa.
Related Issues (20)
- [fix] DESCRIPTIVE TITLE HOT 2
- Can't access peer/client certificate with Koa HOT 1
- Why does routing fail when asynchronous middleware is used with routing HOT 2
- [fix] ctx.request.origin ignores proxy flag (X-Forwarded-Proto) HOT 2
- Issue with reassigning ctx.query and type preservation HOT 2
- [feat] send json type content when call ctx.throw HOT 1
- [fix] Has callback() changed return type? Now error from eslint HOT 5
- [feat] Could a listen() shortcut function be added also for http2? HOT 3
- [fix] Some things cannot be found in the database where condition search, unless the where condition search ID HOT 3
- koa 2.14.7 No generics,I want to be able to add generics HOT 1
- [feat] when will koa 3.0 be released? HOT 3
- Koa main website example code snippets disappear HOT 4
- [feat] Objects as middleware HOT 6
- [feat] Support Web (WHATWG) stream, Blob and Response HOT 2
- Consider alternatives to http-assert (including none at all) HOT 4
- [fix] Send response as buffer HOT 4
- async issue on app.listen(...) HOT 4
- [fix] I can not get query parameters about Korean HOT 3
- [feat] Spanish translation for docs
- Routing sucks, moving back to express. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koa.