@clonegod/ttd-core 2.0.77 → 2.0.78

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.
@@ -24,4 +24,5 @@ export declare class WebSocketClient {
24
24
  isConnected(): boolean;
25
25
  private startKeepAlive;
26
26
  private stopKeepAlive;
27
+ private setupGlobalErrorHandlers;
27
28
  }
@@ -23,6 +23,7 @@ class WebSocketClient {
23
23
  this.keepAliveTimer = null;
24
24
  this.url = url;
25
25
  this.options = Object.assign({ reconnectInterval: 3000, rejectUnauthorized: false, keepAlive: false, keepAliveInterval: 30000 }, options);
26
+ this.setupGlobalErrorHandlers();
26
27
  (0, dist_1.log_info)(`WebSocketClient constructor, url: ${this.url}`, this.options);
27
28
  }
28
29
  connect() {
@@ -122,5 +123,13 @@ class WebSocketClient {
122
123
  (0, dist_1.log_info)('KeepAlive stopped');
123
124
  }
124
125
  }
126
+ setupGlobalErrorHandlers() {
127
+ process.on('uncaughtException', (error) => {
128
+ (0, dist_1.log_error)('Uncaught Exception in WebSocketClient:', error);
129
+ });
130
+ process.on('unhandledRejection', (reason, promise) => {
131
+ (0, dist_1.log_error)('Unhandled Rejection in WebSocketClient:', reason instanceof Error ? reason : new Error(String(reason)));
132
+ });
133
+ }
125
134
  }
126
135
  exports.WebSocketClient = WebSocketClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-core",
3
- "version": "2.0.77",
3
+ "version": "2.0.78",
4
4
  "description": "Common types and utilities for trading systems - use `npm run push` to publish",
5
5
  "main": "dist/index.js",
6
6
  "types": "types/index.d.ts",