dolphindb 2.0.509 → 2.0.510

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1585,25 +1585,30 @@ class DDB {
1585
1585
  catch { }
1586
1586
  // 临界区结束,只有一个 rpc 函数调用运行到这里,可以独占 this.on_message 然后写 WebSocket
1587
1587
  this.on_message = ({ data: buffer }) => {
1588
- const buf = new Uint8Array(buffer);
1589
- if (this.print_message_buffer)
1590
- console.log((0, utils_js_1.typed_array_to_buffer)(buf));
1591
- const message = this.parse_message(buf, parse_object);
1592
- listener?.(message, this);
1593
- for (const listener of _handlers)
1594
- listener(message, this);
1595
- const { type, data } = message;
1596
- switch (type) {
1597
- case 'print':
1598
- if (this.print_message)
1599
- console.log(data);
1600
- return;
1601
- case 'object':
1602
- resolve(data);
1603
- return;
1604
- case 'error':
1605
- reject(data);
1606
- return;
1588
+ try {
1589
+ const buf = new Uint8Array(buffer);
1590
+ if (this.print_message_buffer)
1591
+ console.log((0, utils_js_1.typed_array_to_buffer)(buf));
1592
+ const message = this.parse_message(buf, parse_object);
1593
+ listener?.(message, this);
1594
+ for (const listener of _handlers)
1595
+ listener(message, this);
1596
+ const { type, data } = message;
1597
+ switch (type) {
1598
+ case 'print':
1599
+ if (this.print_message)
1600
+ console.log(data);
1601
+ return;
1602
+ case 'object':
1603
+ resolve(data);
1604
+ return;
1605
+ case 'error':
1606
+ reject(data);
1607
+ return;
1608
+ }
1609
+ }
1610
+ catch (error) {
1611
+ reject(error);
1607
1612
  }
1608
1613
  };
1609
1614
  args = this.to_ddbobjs(args);