vedatrace 0.1.7 → 0.1.8

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/dist/index.cjs CHANGED
@@ -59,7 +59,11 @@ class VedaTraceBatcher {
59
59
  const combinedError = new Error(
60
60
  `Failed to send logs after ${this.config.maxRetries} retries: ${errors.map((e) => e.message).join(", ")}`
61
61
  );
62
- this.onError?.(combinedError);
62
+ if (this.onError) {
63
+ this.onError(combinedError);
64
+ } else {
65
+ console.error("[VedaTrace]", combinedError.message);
66
+ }
63
67
  return;
64
68
  }
65
69
  this.onSuccess?.();
@@ -71,7 +75,18 @@ class VedaTraceBatcher {
71
75
  }
72
76
  this.flushTimer = setInterval(() => {
73
77
  if (this.queue.length > 0) {
74
- this.flush();
78
+ this.flush().catch((error) => {
79
+ if (this.onError) {
80
+ this.onError(
81
+ error instanceof Error ? error : new Error(String(error))
82
+ );
83
+ } else {
84
+ console.error(
85
+ "[VedaTrace] Flush error:",
86
+ error instanceof Error ? error.message : String(error)
87
+ );
88
+ }
89
+ });
75
90
  }
76
91
  }, this.config.flushInterval);
77
92
  if (this.config.unrefTimer === true) {
package/dist/index.mjs CHANGED
@@ -55,7 +55,11 @@ class VedaTraceBatcher {
55
55
  const combinedError = new Error(
56
56
  `Failed to send logs after ${this.config.maxRetries} retries: ${errors.map((e) => e.message).join(", ")}`
57
57
  );
58
- this.onError?.(combinedError);
58
+ if (this.onError) {
59
+ this.onError(combinedError);
60
+ } else {
61
+ console.error("[VedaTrace]", combinedError.message);
62
+ }
59
63
  return;
60
64
  }
61
65
  this.onSuccess?.();
@@ -67,7 +71,18 @@ class VedaTraceBatcher {
67
71
  }
68
72
  this.flushTimer = setInterval(() => {
69
73
  if (this.queue.length > 0) {
70
- this.flush();
74
+ this.flush().catch((error) => {
75
+ if (this.onError) {
76
+ this.onError(
77
+ error instanceof Error ? error : new Error(String(error))
78
+ );
79
+ } else {
80
+ console.error(
81
+ "[VedaTrace] Flush error:",
82
+ error instanceof Error ? error.message : String(error)
83
+ );
84
+ }
85
+ });
71
86
  }
72
87
  }, this.config.flushInterval);
73
88
  if (this.config.unrefTimer === true) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vedatrace",
3
3
  "description": "Universal JavaScript logging SDK for VedaTrace - type-safe, lightweight, and developer-friendly",
4
- "version": "0.1.7",
4
+ "version": "0.1.8",
5
5
  "scripts": {
6
6
  "setup": "rm -rf node_modules && npm i && git init && husky",
7
7
  "prepublishOnly": "npm run build",
@@ -23,7 +23,7 @@
23
23
  ],
24
24
  "lint-staged": {
25
25
  "*.{ts,tsx}": [
26
- "npm run lint"
26
+ "bun run lint"
27
27
  ]
28
28
  },
29
29
  "type": "module",