app.silent option to turn off err logging
This commit is contained in:
parent
b2bcbcec7c
commit
c369b33b23
2 changed files with 3 additions and 2 deletions
|
@ -165,7 +165,7 @@ app.onerror = function(err){
|
||||||
assert(err instanceof Error, 'non-error thrown: ' + err);
|
assert(err instanceof Error, 'non-error thrown: ' + err);
|
||||||
|
|
||||||
if (404 == err.status || err.expose) return;
|
if (404 == err.status || err.expose) return;
|
||||||
if ('test' == this.env) return;
|
if (this.silent) return;
|
||||||
|
|
||||||
var msg = err.stack || err.toString();
|
var msg = err.stack || err.toString();
|
||||||
console.error();
|
console.error();
|
||||||
|
|
|
@ -161,8 +161,9 @@ describe('app.onerror(err)', function(){
|
||||||
done();
|
done();
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should do nothing if env is test', function(done){
|
it('should do nothing if .silent', function(done){
|
||||||
var app = koa();
|
var app = koa();
|
||||||
|
app.silent = true;
|
||||||
var err = new Error();
|
var err = new Error();
|
||||||
|
|
||||||
var output = stderr.inspectSync(function() {
|
var output = stderr.inspectSync(function() {
|
||||||
|
|
Loading…
Reference in a new issue