Agenda refactor
This commit is contained in:
parent
45194e6a90
commit
90ecf450b4
@ -68,9 +68,38 @@ export async function discoverInfomaniakCalendars(
|
||||
logger.debug('CalDAV client created, attempting to list directory contents');
|
||||
|
||||
// List all calendars using PROPFIND on root
|
||||
const items = await client.getDirectoryContents('/');
|
||||
|
||||
logger.debug(`Successfully retrieved ${items.length} items from CalDAV server`);
|
||||
let items;
|
||||
try {
|
||||
items = await client.getDirectoryContents('/');
|
||||
logger.debug(`Successfully retrieved ${items.length} items from CalDAV server`);
|
||||
} catch (dirError: any) {
|
||||
// Log more details about the error
|
||||
const errorDetails: any = {
|
||||
email,
|
||||
error: dirError?.message || String(dirError),
|
||||
status: dirError?.status,
|
||||
statusText: dirError?.statusText,
|
||||
};
|
||||
|
||||
// Try to extract more details from the error
|
||||
if (dirError?.response) {
|
||||
errorDetails.responseStatus = dirError.response.status;
|
||||
errorDetails.responseStatusText = dirError.response.statusText;
|
||||
errorDetails.responseHeaders = dirError.response.headers;
|
||||
}
|
||||
|
||||
// Check if it's a 401 error specifically
|
||||
if (dirError?.status === 401 || dirError?.response?.status === 401) {
|
||||
logger.error('CalDAV authentication failed (401 Unauthorized)', {
|
||||
...errorDetails,
|
||||
hint: 'This usually means: 1) Password is incorrect, 2) Password has changed, 3) 2FA is enabled and requires an app-specific password, 4) Account credentials are invalid',
|
||||
});
|
||||
} else {
|
||||
logger.error('Error listing directory contents', errorDetails);
|
||||
}
|
||||
|
||||
throw dirError;
|
||||
}
|
||||
|
||||
const calendars: CalDAVCalendar[] = [];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user