mirror of
https://github.com/p-stream/p-stream.git
synced 2026-03-11 17:55:33 +00:00
clean up error logging
This commit is contained in:
parent
f0dde1e78f
commit
1e949ed530
1 changed files with 13 additions and 3 deletions
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue