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])) { if (!isset($aAccounts[$sEmail])) {
throw new ClientException(Notifications::AccountDoesNotExist); throw new ClientException(Notifications::AccountDoesNotExist);
} }
$oAccount = AdditionalAccount::NewInstanceFromTokenArray( try {
$this, $aAccounts[$sEmail] $oAccount = AdditionalAccount::NewInstanceFromTokenArray(
); $this, $aAccounts[$sEmail], true
);
} catch (\Throwable $e) {
throw new ClientException(Notifications::AccountSwitchFailed, $e);
}
if (!$oAccount) { if (!$oAccount) {
throw new ClientException(Notifications::AccountSwitchFailed); throw new ClientException(Notifications::AccountSwitchFailed);
} }