@atmosx/event-product-parser 2.0.11 → 2.0.12

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.
@@ -4910,18 +4910,6 @@ var definitions = {
4910
4910
  dump_cache_complete: `Completed dumping all cached alert files.`
4911
4911
  }
4912
4912
  };
4913
- process.on("uncaughtException", (err) => {
4914
- if ((err == null ? void 0 : err.code) === "ETIMEDOUT") {
4915
- return;
4916
- }
4917
- if ((err == null ? void 0 : err.code) === "ECONNRESET") {
4918
- return;
4919
- }
4920
- if ((err == null ? void 0 : err.code) === "EHOSTUNREACH") {
4921
- return;
4922
- }
4923
- throw err;
4924
- });
4925
4913
 
4926
4914
  // src/@parsers/text.ts
4927
4915
  var TextParser = class {
@@ -7338,6 +7326,7 @@ var eas_default = EAS;
7338
7326
  // src/index.ts
7339
7327
  var Manager = class {
7340
7328
  constructor(metadata) {
7329
+ this.sigCatch();
7341
7330
  this.start(metadata);
7342
7331
  }
7343
7332
  /**
@@ -7537,6 +7526,25 @@ var Manager = class {
7537
7526
  }
7538
7527
  });
7539
7528
  }
7529
+ /**
7530
+ * @function sigCatch
7531
+ * @description
7532
+ * Sets up a global handler for uncaught exceptions, ignoring specific error codes
7533
+ *
7534
+ * @async
7535
+ * @returns void
7536
+ */
7537
+ sigCatch() {
7538
+ process.on("uncaughtException", (err) => {
7539
+ var _a;
7540
+ const ignored = ["ETIMEDOUT", "ECONNRESET", "EHOSTUNREACH", "STARTTLS_FAILURE"];
7541
+ if (ignored.includes(err == null ? void 0 : err.code)) {
7542
+ utils_default.warn(`XMPP Critical Error: ${(_a = err == null ? void 0 : err.code) != null ? _a : "Unknown error code"}. This may indicate a connection issue. Attempting to continue...`);
7543
+ return;
7544
+ }
7545
+ utils_default.warn(`Uncaught Exception: ${err instanceof Error ? err.stack || err.message : String(err)}`);
7546
+ });
7547
+ }
7540
7548
  };
7541
7549
  var index_default = Manager;
7542
7550
  // Annotate the CommonJS export names for ESM import in node:
@@ -4898,18 +4898,6 @@ var definitions = {
4898
4898
  dump_cache_complete: `Completed dumping all cached alert files.`
4899
4899
  }
4900
4900
  };
4901
- process.on("uncaughtException", (err) => {
4902
- if ((err == null ? void 0 : err.code) === "ETIMEDOUT") {
4903
- return;
4904
- }
4905
- if ((err == null ? void 0 : err.code) === "ECONNRESET") {
4906
- return;
4907
- }
4908
- if ((err == null ? void 0 : err.code) === "EHOSTUNREACH") {
4909
- return;
4910
- }
4911
- throw err;
4912
- });
4913
4901
 
4914
4902
  // src/@parsers/text.ts
4915
4903
  var TextParser = class {
@@ -7326,6 +7314,7 @@ var eas_default = EAS;
7326
7314
  // src/index.ts
7327
7315
  var Manager = class {
7328
7316
  constructor(metadata) {
7317
+ this.sigCatch();
7329
7318
  this.start(metadata);
7330
7319
  }
7331
7320
  /**
@@ -7525,6 +7514,25 @@ var Manager = class {
7525
7514
  }
7526
7515
  });
7527
7516
  }
7517
+ /**
7518
+ * @function sigCatch
7519
+ * @description
7520
+ * Sets up a global handler for uncaught exceptions, ignoring specific error codes
7521
+ *
7522
+ * @async
7523
+ * @returns void
7524
+ */
7525
+ sigCatch() {
7526
+ process.on("uncaughtException", (err) => {
7527
+ var _a;
7528
+ const ignored = ["ETIMEDOUT", "ECONNRESET", "EHOSTUNREACH", "STARTTLS_FAILURE"];
7529
+ if (ignored.includes(err == null ? void 0 : err.code)) {
7530
+ utils_default.warn(`XMPP Critical Error: ${(_a = err == null ? void 0 : err.code) != null ? _a : "Unknown error code"}. This may indicate a connection issue. Attempting to continue...`);
7531
+ return;
7532
+ }
7533
+ utils_default.warn(`Uncaught Exception: ${err instanceof Error ? err.stack || err.message : String(err)}`);
7534
+ });
7535
+ }
7528
7536
  };
7529
7537
  var index_default = Manager;
7530
7538
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atmosx/event-product-parser",
3
- "version": "2.0.011",
3
+ "version": "2.0.012",
4
4
  "description": "NOAA Weather Wire & NWS API Parser - Built for standalone and Project AtmosphericX Integration.",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "module": "dist/esm/index.mjs",
@@ -30,7 +30,7 @@ export class TextParser {
30
30
  * @param {string[]} [removal=[]]
31
31
  * @returns {string | null}
32
32
  */
33
- public static textProductToString(message: string,value: string,removal: string[] = []): string | null {
33
+ public static textProductToString(message: string, value: string, removal: string[] = []): string | null {
34
34
  const lines = message.split('\n');
35
35
  for (const line of lines) {
36
36
  if (line.includes(value)) {
package/src/bootstrap.ts CHANGED
@@ -179,12 +179,4 @@ export const definitions = {
179
179
  dump_cache: `Found {count} cached events and will begin dumping them shortly. This may take a while depending on the number of cached events.`,
180
180
  dump_cache_complete: `Completed dumping all cached alert files.`,
181
181
  }
182
- };
183
-
184
-
185
- process.on('uncaughtException', (err: any) => {
186
- if (err?.code === 'ETIMEDOUT') { return; }
187
- if (err?.code === 'ECONNRESET') { return; }
188
- if (err?.code === 'EHOSTUNREACH') { return; }
189
- throw err;
190
- })
182
+ };
package/src/index.ts CHANGED
@@ -27,7 +27,10 @@ import UGCParser from './@parsers/ugc';
27
27
  export class Manager {
28
28
  isNoaaWeatherWireService: boolean
29
29
  job: any
30
- constructor(metadata: types.ClientSettingsTypes) { this.start(metadata) }
30
+ constructor(metadata: types.ClientSettingsTypes) {
31
+ this.sigCatch();
32
+ this.start(metadata)
33
+ }
31
34
 
32
35
  /**
33
36
  * @function setDisplayName
@@ -211,6 +214,25 @@ export class Manager {
211
214
  this.isNoaaWeatherWireService = false;
212
215
  }
213
216
  }
217
+
218
+ /**
219
+ * @function sigCatch
220
+ * @description
221
+ * Sets up a global handler for uncaught exceptions, ignoring specific error codes
222
+ *
223
+ * @async
224
+ * @returns void
225
+ */
226
+ private sigCatch() {
227
+ process.on('uncaughtException', (err: any) => {
228
+ const ignored = ['ETIMEDOUT', 'ECONNRESET', 'EHOSTUNREACH', 'STARTTLS_FAILURE'];
229
+ if (ignored.includes(err?.code)) {
230
+ Utils.warn(`XMPP Critical Error: ${err?.code ?? 'Unknown error code'}. This may indicate a connection issue. Attempting to continue...`);
231
+ return;
232
+ }
233
+ Utils.warn(`Uncaught Exception: ${err instanceof Error ? err.stack || err.message : String(err)}`);
234
+ })
235
+ }
214
236
  }
215
237
 
216
238
  export default Manager;