Detailed error message on account switch failure for #1594

This commit is contained in:
the-djmaze 2024-07-07 15:54:48 +02:00
parent 288ff23f2b
commit 7a1652972d

View file

@ -205,9 +205,13 @@ trait UserAuth
if (!isset($aAccounts[$sEmail])) {
throw new ClientException(Notifications::AccountDoesNotExist);
}
$oAccount = AdditionalAccount::NewInstanceFromTokenArray(
$this, $aAccounts[$sEmail]
);
try {
$oAccount = AdditionalAccount::NewInstanceFromTokenArray(
$this, $aAccounts[$sEmail], true
);
} catch (\Throwable $e) {
throw new ClientException(Notifications::AccountSwitchFailed, $e);
}
if (!$oAccount) {
throw new ClientException(Notifications::AccountSwitchFailed);
}