Skip to content

Commit b568be3

Browse files
committed
Separate error reports into anonymous sessions
1 parent c5ff88b commit b568be3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/errors.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { randomUUID } from 'crypto';
2+
13
const DEV_MODE = process.env.HTK_DEV === 'true';
24

35
import * as Sentry from '@sentry/electron';
@@ -19,6 +21,14 @@ if (!DEV_MODE) {
1921
})
2022
]
2123
});
24+
25+
Sentry.configureScope((scope) => {
26+
// We use a random id to distinguish between many errors in one session vs
27+
// one error in many sessions. This isn't persisted and can't be used to
28+
// identify anybody between sessions.
29+
const randomId = randomUUID();
30+
scope.setUser({ id: randomId, username: `anon-${randomId}` });
31+
});
2232
}
2333

2434
export function logError(error: Error | string, fingerprint?: string[]) {

0 commit comments

Comments
 (0)