Bugfix: ClientException #1706

This commit is contained in:
the-djmaze 2024-09-20 23:33:25 +02:00
parent 16cc17af00
commit 5056ecf493

View file

@ -2,6 +2,8 @@
namespace RainLoop\Providers; namespace RainLoop\Providers;
use RainLoop\Exceptions\ClientException;
class Domain extends AbstractProvider class Domain extends AbstractProvider
{ {
/** /**
@ -35,7 +37,7 @@ class Domain extends AbstractProvider
public function SaveAlias(string $sName, string $sAlias) : bool public function SaveAlias(string $sName, string $sAlias) : bool
{ {
if ($this->Load($sName, false, false)) { if ($this->Load($sName, false, false)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists); throw new ClientException(\RainLoop\Notifications::DomainAlreadyExists);
} }
return $this->oDriver->SaveAlias($sName, $sAlias); return $this->oDriver->SaveAlias($sName, $sAlias);
} }
@ -63,7 +65,7 @@ class Domain extends AbstractProvider
} }
if (\strlen($sName) || $sNameForTest) { if (\strlen($sName) || $sNameForTest) {
if (!$sNameForTest && !empty($oActions->GetActionParam('create', 0)) && $this->Load($sName)) { if (!$sNameForTest && !empty($oActions->GetActionParam('create', 0)) && $this->Load($sName)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists); throw new ClientException(\RainLoop\Notifications::DomainAlreadyExists);
} }
return \RainLoop\Model\Domain::fromArray($sNameForTest ?: $sName, [ return \RainLoop\Model\Domain::fromArray($sNameForTest ?: $sName, [
'IMAP' => $oActions->GetActionParam('IMAP'), 'IMAP' => $oActions->GetActionParam('IMAP'),