-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathmodifiations.txt
48 lines (43 loc) · 2.18 KB
/
modifiations.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
1:
node_modules/home-assistant-js-websocket/dist/haws.cjs
line 227: Add try/catch for JSON.parse
// >>> @ronny.winkler@web.de: catch exception caused by invalid JSON content
// let messageGroup = JSON.parse(event.data);
let messageGroup = {};
try{
messageGroup = JSON.parse(event.data);
}
catch(error){
console.error('Invalid JSON: ', error.message);
}
// <<<
line 231: Add "async"
// >>> @ronny.winkler@web.de: await call als write log instead of getting unhandled exception
// messageGroup.forEach(async (message) => {
messageGroup.forEach(async (message) => {
// <<<
line 242: add try/catch and await
else {
console.warn(`Received event for unknown subscription ${message.id}. Unsubscribing.`);
// >>> @ronny.winkler@web.de: await call als write log instead of getting unhandled exception
// this.sendMessagePromise(unsubscribeEvents(message.id));
try{
await this.sendMessagePromise(unsubscribeEvents(message.id));
}
catch(error){
console.error(`Error unsubscribing unknown subscription ${message.id}.`);
}
// <<<
}
line 522: add try/catch to catch unhandled async exception
if (this.connected) {
// >>> @ronny.winkler@web.de: await call als write log instead of getting unhandled exception
// await this.sendMessagePromise(unsubscribeEvents(commandId));
try{
await this.sendMessagePromise(unsubscribeEvents(commandId));
}
catch(error){
console.error(`Error unsubscribing event, command ID: ${commandId}.`);
}
// <<<
}