Agenda Sync refactor

This commit is contained in:
alma 2026-01-14 15:58:45 +01:00
parent 1bdafdf408
commit 5ecc7c9500
2 changed files with 11 additions and 2 deletions

View File

@ -98,9 +98,17 @@ export async function discoverInfomaniakCalendars(
return calendars;
} catch (error) {
const errorMessage = error instanceof Error ? error.message : String(error);
const errorDetails = error instanceof Error ? {
name: error.name,
message: error.message,
stack: error.stack?.substring(0, 200), // First 200 chars of stack
} : { raw: String(error) };
logger.error('Error discovering Infomaniak calendars', {
email,
error: error instanceof Error ? error.message : String(error),
error: errorMessage,
errorDetails,
});
// Ne pas faire échouer toute la page agenda si la découverte échoue
// On retourne simplement une liste vide -> pas de sync auto possible

View File

@ -51,7 +51,8 @@ export async function exchangeCodeForTokens(code: string): Promise<{
client_secret: clientSecret!,
code,
redirect_uri: redirectUri!,
grant_type: 'authorization_code'
grant_type: 'authorization_code',
scope: REQUIRED_SCOPES // Include scopes in token exchange
});
try {