]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - index.php
Dislay an error if an exception occurs in the error handler
[github/shaarli/Shaarli.git] / index.php
index 220847f5ec4f3469af3e2eb32e08b5f6cc2c4ab9..b6ee8ebc482b585e01bf858bc97ae90184b172c1 100644 (file)
--- a/index.php
+++ b/index.php
@@ -151,6 +151,12 @@ $app->group('/api/v1', function () {
     $this->get('/history', '\Shaarli\Api\Controllers\HistoryController:getHistory')->setName('getHistory');
 })->add('\Shaarli\Api\ApiMiddleware');
 
-$response = $app->run(true);
-
-$app->respond($response);
+try {
+    $response = $app->run(true);
+    $app->respond($response);
+} catch (Throwable $e) {
+    die(nl2br(
+        'An unexpected error happened, and the error template could not be displayed.' . PHP_EOL . PHP_EOL .
+       exception2text($e)
+    ));
+}