clean up error logging

This commit is contained in:
Pas 2026-02-25 11:41:23 -07:00
parent f0dde1e78f
commit 1e949ed530

View file

@ -79,7 +79,11 @@ export class TraktService {
} catch (error: any) { } catch (error: any) {
const msg = const msg =
error?.data?.message ?? error?.message ?? "Failed to exchange code"; error?.data?.message ?? error?.message ?? "Failed to exchange code";
console.error("[TraktService] Failed to exchange code:", error); const status = error?.response?.status;
console.error(
"[TraktService] Failed to exchange code:",
status ? `${status} - ${msg}` : msg,
);
throw new Error(msg); throw new Error(msg);
} }
} }
@ -112,8 +116,14 @@ export class TraktService {
useTraktAuthStore useTraktAuthStore
.getState() .getState()
.setTokens(data.access_token, data.refresh_token, expiresAt); .setTokens(data.access_token, data.refresh_token, expiresAt);
} catch (error) { } catch (error: any) {
console.error("[TraktService] Failed to refresh token:", error); const msg =
error?.data?.message ?? error?.message ?? "Failed to refresh token";
const status = error?.response?.status;
console.error(
"[TraktService] Failed to refresh token:",
status ? `${status} - ${msg}` : msg,
);
useTraktAuthStore.getState().clear(); useTraktAuthStore.getState().clear();
throw error; throw error;
} }