Merge pull request #486 from tejasmanohar/app_silent

app.silent option to turn off err logging
master
fengmk2 2015-10-09 11:22:58 +08:00
commit f875eb0c30
2 changed files with 4 additions and 1 deletions

View File

@ -166,6 +166,8 @@ app.onerror = function(err){
assert(err instanceof Error, 'non-error thrown: ' + err);
if (404 == err.status || err.expose) return;
if (this.silent) return;
// DEPRECATE env-specific logging in v2
if ('test' == this.env) return;
var msg = err.stack || err.toString();

View File

@ -161,8 +161,9 @@ describe('app.onerror(err)', function(){
done();
})
it('should do nothing if env is test', function(done){
it('should do nothing if .silent', function(done){
var app = koa();
app.silent = true;
var err = new Error();
var output = stderr.inspectSync(function() {