@exodus/error-tracking 3.0.0 → 3.0.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
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [3.0.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/error-tracking@3.0.0...@exodus/error-tracking@3.0.1) (2025-08-21)
7
+
8
+ ### Bug Fixes
9
+
10
+ - fix: respect ab-testing variant for sentry (#13655)
11
+
6
12
  ## [3.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/error-tracking@2.2.0...@exodus/error-tracking@3.0.0) (2025-07-01)
7
13
 
8
14
  ### ⚠ BREAKING CHANGES
@@ -7,19 +7,25 @@ const createErrorTracking = ({
7
7
  config,
8
8
  logger,
9
9
  }) => {
10
- const track = async ({ error, context, namespace }) => {
10
+ const track = async ({ error, context, namespace, silent = true, timeout = 5000 }) => {
11
+ const onError = (err) => {
12
+ logger.error(err)
13
+ if (!silent) throw err
14
+ }
15
+
16
+ logger.error(error)
17
+
11
18
  if (namespace !== undefined && typeof namespace !== 'string') {
12
- throw new Error('namespace must be a string')
19
+ return onError(new Error('namespace must be a string'))
13
20
  }
14
21
 
15
22
  if (!(error instanceof Error)) {
16
- throw new TypeError('error must be an instance of Error')
23
+ return onError(new TypeError('error must be an instance of Error'))
17
24
  }
18
25
 
19
26
  // TODO: figure out what to do with `context`
20
-
21
- // eventually kill this and only track remote
22
- await errorsAtom.set(({ errors }) => {
27
+ // TODO: eventually kill this and only track remote
28
+ const localPromise = errorsAtom.set(({ errors }) => {
23
29
  return {
24
30
  // this array can be big. not sure about prefering spread operator here
25
31
  // concat function seems like a better option
@@ -30,13 +36,29 @@ const createErrorTracking = ({
30
36
  }
31
37
  })
32
38
 
33
- if (remoteErrorTracking) {
34
- remoteErrorTrackingEnabledAtom
35
- .get()
36
- .then((enabled) => enabled && remoteErrorTracking.track({ error }))
37
- .catch((err) => {
38
- logger.error('failed to upload error', error, err)
39
- })
39
+ const remotePromise = remoteErrorTracking
40
+ ? remoteErrorTrackingEnabledAtom
41
+ .get()
42
+ .then((enabled) => enabled && remoteErrorTracking.track({ error }))
43
+ : Promise.resolve()
44
+
45
+ let timeoutId
46
+ const timeoutPromise = new Promise((resolve, reject) => {
47
+ timeoutId = setTimeout(() => {
48
+ reject(new Error('track call timed out'))
49
+ }, timeout)
50
+ })
51
+
52
+ try {
53
+ await Promise.race([
54
+ //
55
+ Promise.all([localPromise, remotePromise]),
56
+ timeoutPromise,
57
+ ])
58
+ } catch (err) {
59
+ onError(err)
60
+ } finally {
61
+ clearTimeout(timeoutId)
40
62
  }
41
63
  }
42
64
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/error-tracking",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "type": "module",
5
5
  "description": "A simple error tracking package to let any feature collect errors and create the report",
6
6
  "author": "Exodus Movement, Inc.",
@@ -43,5 +43,5 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
- "gitHead": "7425cf446dbe32c407ac46bd1c0463787cf8deb6"
46
+ "gitHead": "16007bf14e75a4a9b80efba3a884593f9fab15d4"
47
47
  }
@@ -8,8 +8,14 @@ export default function whyIsRemoteTrackingDisabled({
8
8
  buildMetadata,
9
9
  }) {
10
10
  if (!remoteErrorTrackingABExperimentId) return 'missing-ab-experiment-id'
11
- if (!abTesting.experiments?.[remoteErrorTrackingABExperimentId]?.enabled)
11
+ if (!abTesting.experiments?.[remoteErrorTrackingABExperimentId]?.enabled) {
12
12
  return 'ab-experiment-disabled'
13
+ }
14
+
15
+ if (abTesting.variants?.[remoteErrorTrackingABExperimentId] !== 'enabled') {
16
+ return 'ab-experiment-variant-disabled'
17
+ }
18
+
13
19
  if (
14
20
  trackWalletsCreatedAfter &&
15
21
  // the negation's a bit harder to read but is a safer check