Don't silenty ignore duplicate errors when managing Panes/Dashlets

This commit is contained in:
Yonas Habteab 2022-06-03 17:52:01 +02:00
parent a118831b38
commit 12af0d2ce1
2 changed files with 14 additions and 4 deletions

View File

@ -242,8 +242,13 @@ class DashboardHome extends BaseDashboard implements Sortable
'priority' => $movePane ? $order++ : $pane->getPriority()
], $filterCondition);
} else {
// Failed to move the pane! Should have been handled already by the caller
break;
// Failed to move the pane! Should have already been handled by the caller,
// though I think it's better that we raise an exception here!!
throw new \LogicException(sprintf(
'Dashboard Pane "%s" could not be managed. Dashboard Home "%s" has Pane with the same name!',
$pane->getTitle(),
$this->getTitle()
));
}
$pane->setHome($this);

View File

@ -236,8 +236,13 @@ class Pane extends BaseDashboard implements Sortable
'disabled' => DBUtils::bool2BoolEnum($dashlet->isDisabled())
], $filterCondition);
} else {
// This should have already been handled by the caller
break;
// Failed to move the pane! Should have already been handled by the caller,
// though I think it's better that we raise an exception here!!
throw new \LogicException(sprintf(
'Dashlet "%s" could not be managed. Dashboard Pane "%s" has a Dashlet with the same name!',
$dashlet->getTitle(),
$this->getTitle()
));
}
$dashlet->setPane($this);