Skip to content

Commit 7856502

Browse files
committed
fix: Set caller to unknown_caller for notified functions
Signed-off-by: Gerard Hickey <[email protected]>
1 parent b51bb16 commit 7856502

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

www/chat.js

+18-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ function monitor_last_update() {
2222

2323
function update_messages(reason=Messages.MSG_UPDATE) {
2424
if (reason != Messages.MSG_UPDATE) return;
25-
let caller = (new Error()).stack.split("\n")[3].split("/")[0];
25+
try {
26+
var caller = (new Error()).stack.split("\n")[3].split("/")[0];
27+
}
28+
catch (TypeError) {
29+
var caller = "unknown_caller";
30+
}
2631
console.debug(caller + "->update_messages(reason=MSG_UPDATE)");
2732

2833
// update the message table
@@ -33,14 +38,24 @@ function update_messages(reason=Messages.MSG_UPDATE) {
3338

3439
function new_messages(reason) {
3540
if (reason != Messages.NEW_MSG) return;
36-
let caller = (new Error()).stack.split("\n")[3].split("/")[0];
41+
try {
42+
var caller = (new Error()).stack.split("\n")[3].split("/")[0];
43+
}
44+
catch (TypeError) {
45+
var caller = "unknown_caller";
46+
}
3747
console.debug(caller + "->new_messages(reason=NEW_MSG)");
3848
alert.play();
3949
}
4050

4151
function update_channels(reason) {
4252
if (reason != Messages.CHAN_UPDATE) return;
43-
let caller = (new Error()).stack.split("\n")[3].split("/")[0];
53+
try {
54+
var caller = (new Error()).stack.split("\n")[3].split("/")[0];
55+
}
56+
catch (TypeError) {
57+
var caller = "unknown_caller";
58+
}
4459
console.debug(caller + "->update_channels(reason=CHAN_UPDATE)");
4560

4661
let msg_refresh = false;

0 commit comments

Comments
 (0)