Add better error logging (#15383)

This commit is contained in:
Joe Au-Yeung
2024-06-10 10:10:19 +00:00
committed by GitHub
parent e38705c3e8
commit 06231ec299
@@ -12,12 +12,14 @@ export function getTokenObjectFromCredential(credential: CredentialPayload) {
"GoogleCalendarService-getTokenObjectFromCredential",
safeStringify(parsedTokenResponse.error.issues)
);
throw new Error("Could not parse credential.key");
throw new Error(
`Could not parse credential.key ${credential.id} with error: ${parsedTokenResponse?.error}`
);
}
const tokenResponse = parsedTokenResponse.data;
if (!tokenResponse) {
throw new Error("credential.key is not set");
throw new Error(`credential.key is not set for credential ${credential.id}`);
}
return tokenResponse;