AddNodeForm: Don't throw error while adding existing invalid config file

This commit is contained in:
Sukhwinder Dhillon 2023-07-25 10:01:43 +02:00 committed by Johannes Meyer
parent da0c72d578
commit 071f006b7d

View file

@ -2,6 +2,7 @@
namespace Icinga\Module\Businessprocess\Forms;
use Exception;
use Icinga\Module\Businessprocess\BpNode;
use Icinga\Module\Businessprocess\BpConfig;
use Icinga\Module\Businessprocess\Common\EnumList;
@ -471,7 +472,13 @@ class AddNodeForm extends QuickForm
$bp = $this->bp;
if ($differentFile) {
$bp = $this->storage->loadProcess($file);
try {
$bp = $this->storage->loadProcess($file);
} catch (Exception $e) {
$this->addError('Cannot add invalid config file');
return $list;
}
}
foreach ($bp->getNodes() as $node) {