improve error handling

This commit is contained in:
isUnknown 2025-03-26 17:02:23 +01:00
parent ddd89cc889
commit 636a289d5b

View file

@ -28,7 +28,7 @@ function getProjectData($project)
try { try {
$children = $kirby->user()->role() == 'admin' ? $page->childrenAndDrafts()->map(fn($project) => getProjectData($project))->values() : $kirby->user()->projects()->toPages()->map(fn($project) => getProjectData($project))->values(); $children = $kirby->user()->role() == 'admin' ? $page->childrenAndDrafts()->map(fn($project) => getProjectData($project))->values() : $kirby->user()->projects()->toPages()->map(fn($project) => getProjectData($project))->values();
} catch (\Throwable $th) { } catch (\Throwable $th) {
throw new Exception($th->getMessage() . ' line ' . $th->getLine(), 1); throw new Exception($th->getMessage() . ' line ' . $th->getLine() . ' in file ' . $th->getFile(), 1);
$children = []; $children = [];
} }