Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2732 from matrix-org/travis/rageshake-errors
Browse files Browse the repository at this point in the history
Convert objects and such to usable strings in rageshake
  • Loading branch information
turt2live authored Mar 1, 2019
2 parents 3ce2c3a + e1f2605 commit 593bd8f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/rageshake/rageshake.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ class ConsoleLogger {
log(level, ...args) {
// We don't know what locale the user may be running so use ISO strings
const ts = new Date().toISOString();

// Convert objects and errors to helpful things
args = args.map((arg) => {
if (arg instanceof Error) {
return arg.message + (arg.stack ? `\n${arg.stack}` : '');
} else if (typeof(arg) === 'object') {
return JSON.stringify(arg);
} else {
return arg;
}
});

// Some browsers support string formatting which we're not doing here
// so the lines are a little more ugly but easy to implement / quick to
// run.
Expand Down

0 comments on commit 593bd8f

Please sign in to comment.