Catch Exceptions when loading storage data of users

This avoids having the whole userlist crashing because a user external
 storage fails to load. With this change only the problematic user
 storage/quota information will be empty.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2023-01-12 12:01:21 +01:00 committed by backportbot-nextcloud[bot]
parent f74ba9cb5d
commit eac6d9f36f

View file

@ -267,6 +267,16 @@ abstract class AUserData extends OCSController {
self::USER_FIELD_QUOTA => $quota !== false ? $quota : 'none',
'used' => 0
];
} catch (\Exception $e) {
\OC::$server->get(\Psr\Log\LoggerInterface::class)->error(
"Could not load storage info for {user}",
[
'app' => 'provisioning_api',
'user' => $userId,
'exception' => $e,
]
);
return [];
}
return $data;
}