remove .outputErrors, suppress output when handled by the dev. Closes #272

master
TJ Holowaychuk 2014-05-01 16:29:37 -07:00
parent 4ff54e5c13
commit f17629d19f
3 changed files with 11 additions and 4 deletions

View File

@ -79,7 +79,6 @@ app.listen(3000);
- `app.env` defaulting to the __NODE_ENV__ or "development"
- `app.proxy` when true proxy header fields will be trusted
- `app.subdomainOffset` offset of `.subdomains` to ignore [2]
- `app.outputErrors` output err.stack to stderr [false in "test" environment]
## app.listen(...)

View File

@ -81,7 +81,6 @@ app.listen = function(){
app.toJSON = function(){
return only(this, [
'outputErrors',
'subdomainOffset',
'poweredBy',
'env'
@ -156,8 +155,18 @@ app.createContext = function(req, res){
*/
app.onerror = function(err){
if (!this.outputErrors) return;
if (!err) return;
// suppress output for custom handling
if (1 != this.listeners('error').length) return;
// ignore 404s
if (404 == err.status) return;
// ignore in test env
if ('test' == this.env) return;
// output
console.error();
console.error(err.stack.replace(/^/gm, ' '));
console.error();

View File

@ -53,7 +53,6 @@ describe('app.toJSON()', function(){
var obj = app.toJSON();
obj.should.eql({
outputErrors: false,
subdomainOffset: 2,
poweredBy: true,
env: 'test'