Menu: Swallow silently any DB issue in the main menu

This commit is contained in:
Yonas Habteab 2022-04-08 10:27:35 +02:00
parent fd9c547dde
commit 945a69f0cd

View File

@ -165,15 +165,21 @@ class Menu extends Navigation
$homes = Home::on(Dashboard::getConn());
$homes->filter(Filter::equal('username', $user->getUsername()));
foreach ($homes as $home) {
$dashboardHome = new DashboardHomeItem($home->name, [
'uuid' => $home->id,
'label' => t($home->label),
'priority' => $home->priority,
'type' => $home->type,
]);
try {
foreach ($homes as $home) {
$dashboardHome = new DashboardHomeItem($home->name, [
'uuid' => $home->id,
'label' => t($home->label),
'priority' => $home->priority,
'type' => $home->type,
]);
$dashboardItem->addChild($dashboardHome);
$dashboardItem->addChild($dashboardHome);
}
} catch (\Exception $_) {
// Nothing to do
// Any database issue will be noticed soon enough, so prevent the Menu
// from being ruined in any case.
}
}