diff --git a/lib/application.js b/lib/application.js index d44435afc..f45e6c0a5 100644 --- a/lib/application.js +++ b/lib/application.js @@ -201,9 +201,7 @@ module.exports = class Application extends Emitter { if (this.silent) return; const msg = err.stack || err.toString(); - console.error(); - console.error(msg.replace(/^/gm, ' ')); - console.error(); + console.error(`\n${msg.replace(/^/gm, ' ')}\n`); } }; diff --git a/test/application/onerror.js b/test/application/onerror.js index 487360bd1..44a0c0719 100644 --- a/test/application/onerror.js +++ b/test/application/onerror.js @@ -51,7 +51,7 @@ describe('app.onerror(err)', () => { if (input) msg = input; }); app.onerror(err); - assert(msg === ' Foo'); + assert(msg === '\n Foo\n'); }); it('should use err.toString() instad of err.stack', () => { @@ -68,6 +68,6 @@ describe('app.onerror(err)', () => { if (input) msg = input; }); app.onerror(err); - assert(msg === ' Error: mock stack null'); + assert(msg === '\n Error: mock stack null\n'); }); });