posthog-js-lite 3.4.0 → 3.4.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Next
2
2
 
3
+ # 3.4.1 - 2025-02-20
4
+
5
+ ## Fixed
6
+
7
+ 1. fix: handle cases when non Error is passed to `captureException`
8
+
3
9
  # 3.4.0 - 2025-02-20
4
10
 
5
11
  ## Added
package/lib/index.cjs.js CHANGED
@@ -66,6 +66,9 @@ function safeSetTimeout(fn, timeout) {
66
66
  t?.unref && t?.unref();
67
67
  return t;
68
68
  }
69
+ const isError = (x) => {
70
+ return x instanceof Error;
71
+ };
69
72
  function getFetch() {
70
73
  return typeof fetch !== 'undefined' ? fetch : typeof global.fetch !== 'undefined' ? global.fetch : undefined;
71
74
  }
@@ -1928,8 +1931,8 @@ class PostHogCore extends PostHogCoreStateless {
1928
1931
  $exception_level: 'error',
1929
1932
  $exception_list: [
1930
1933
  {
1931
- type: error.name,
1932
- value: error.message,
1934
+ type: isError(error) ? error.name : 'Error',
1935
+ value: isError(error) ? error.message : error,
1933
1936
  mechanism: {
1934
1937
  handled: true,
1935
1938
  synthetic: false,
@@ -1967,7 +1970,7 @@ class PostHogCore extends PostHogCoreStateless {
1967
1970
  }
1968
1971
  }
1969
1972
 
1970
- var version = "3.4.0";
1973
+ var version = "3.4.1";
1971
1974
 
1972
1975
  function getContext(window) {
1973
1976
  let context = {};