Skip to content

Commit 53cae3a

Browse files
committed
Check that stack trace is available, fixes logging in browser
1 parent 949a1ca commit 53cae3a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/js/ripple/log.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ Log.prototype.error = Log.makeLevel(4);
6969
*/
7070

7171
function getLogInfo(message, args) {
72+
var stack = new Error().stack;
73+
7274
return [
7375
// Timestamp
7476
'[' + new Date().toISOString() + ']',
7577
message,
7678
'--',
7779
// Location
78-
(new Error()).stack.split('\n')[4].replace(/^\s+/, ''),
80+
(typeof stack === 'string') ? stack.split('\n')[4].replace(/^\s+/, '') : '',
7981
'\n'
8082
].concat(args);
8183
}

0 commit comments

Comments
 (0)