dolphindb 2.0.955 → 2.0.957

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/browser.js CHANGED
@@ -2330,6 +2330,7 @@ class DDB {
2330
2330
  resolve();
2331
2331
  }
2332
2332
  catch (error) {
2333
+ this.error ??= error;
2333
2334
  reject(error);
2334
2335
  }
2335
2336
  });
@@ -2366,9 +2367,13 @@ class DDB {
2366
2367
  return options.join('_');
2367
2368
  }
2368
2369
  disconnect() {
2369
- if (this.connected)
2370
- // 这里不获取 lock,直接关闭连接
2371
- this.lwebsocket.resource.close(1000);
2370
+ const { resource } = this.lwebsocket;
2371
+ if (resource) {
2372
+ const { readyState } = resource;
2373
+ if (readyState !== WebSocket.CLOSED && readyState !== WebSocket.CLOSING)
2374
+ // 这里不获取 lock,直接关闭连接
2375
+ resource.close(1000);
2376
+ }
2372
2377
  }
2373
2378
  /** (内部使用的方法) rpc through websocket (function/script/variable command)
2374
2379
  未连接到 DDB 时调用会自动连接,连接断开时调用会抛出 DdbConnectionError