fix: make TelemetryClient throw errors on auth failures to enable proper queue retry

- TelemetryClient now throws errors when authentication fails or session token is missing
- This allows the queue processor to properly identify failed sends and retry them later
- Fixes issue where telemetry events were being discarded when in inactive-session state
- Events will now be queued and retried when authentication is restored
This commit is contained in:
hannesrudolph 2025-08-05 10:23:55 -07:00
parent 951feff080
commit b1806e2d37

View file

@ -27,14 +27,14 @@ export class TelemetryClient extends BaseTelemetryClient {
private async fetch(path: string, options: RequestInit) {
if (!this.authService.isAuthenticated()) {
return
throw new Error("Not authenticated")
}
const token = this.authService.getSessionToken()
if (!token) {
console.error(`[TelemetryClient#fetch] Unauthorized: No session token available.`)
return
throw new Error("No session token available")
}
const response = await fetch(`${getRooCodeApiUrl()}/api/${path}`, {