page: catch exceptions in placeholder scripts
[minimedit.git] / page.php
index b160e45290295d56bfb30a0fd1b1116eba4465e0..33a1f4440ed5469e3aee9e7be5c27913606053f2 100644 (file)
--- a/page.php
+++ b/page.php
@@ -42,8 +42,15 @@ function getoutput($blocks = [])
                                                $Args .= '/'.$param;
                                        }
                                }
-                               include "$name.php";
-                               $html = ob_get_clean();
+                               try {
+                                       include "$name.php";
+                                       $html = ob_get_clean();
+                               }
+                               catch (Exception $e) {
+                                       $html = sprintf('<strong class="warn">%s</strong>',
+                                               "fout in <em>$name</em>: {$e->getMessage()}"
+                                       );
+                               }
                        }
                        else {
                                $html = '<strong class="warn"><em>'.$name.'</em> ontbreekt</strong>';