Skip to content

Commit 5208c5e

Browse files
authored
chore: Use single console.error() statement in error handler (#1471)
1 parent 9ee6584 commit 5208c5e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/application.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,7 @@ module.exports = class Application extends Emitter {
201201
if (this.silent) return;
202202

203203
const msg = err.stack || err.toString();
204-
console.error();
205-
console.error(msg.replace(/^/gm, ' '));
206-
console.error();
204+
console.error(`\n${msg.replace(/^/gm, ' ')}\n`);
207205
}
208206
};
209207

test/application/onerror.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ describe('app.onerror(err)', () => {
5151
if (input) msg = input;
5252
});
5353
app.onerror(err);
54-
assert(msg === ' Foo');
54+
assert(msg === '\n Foo\n');
5555
});
5656

5757
it('should use err.toString() instad of err.stack', () => {
@@ -68,6 +68,6 @@ describe('app.onerror(err)', () => {
6868
if (input) msg = input;
6969
});
7070
app.onerror(err);
71-
assert(msg === ' Error: mock stack null');
71+
assert(msg === '\n Error: mock stack null\n');
7272
});
7373
});

0 commit comments

Comments
 (0)