r4392 Do not show ugly unhandled exception page when possible. Instead, show formatte...
authorAlexey Andriyanov <alan@al-an.info>
Fri, 25 Mar 2011 07:17:00 +0000 (07:17 +0000)
committerAlexey Andriyanov <alan@al-an.info>
Fri, 25 Mar 2011 07:17:00 +0000 (07:17 +0000)
index.php: in exception handler if HTTP_REFERER is set, redirect user there and show formatted exception message.

wwwroot/index.php

index 13b8339..27c2261 100644 (file)
@@ -215,6 +215,12 @@ catch (Exception $e)
        # prevent message appearing in foreign tab
        if (isset ($_SESSION['log']))
                unset ($_SESSION['log']);
-       printException ($e);
+       if (isset ($_SERVER['HTTP_REFERER']))
+       {
+               header('Location: ' . $_SERVER['HTTP_REFERER']);
+               showError ($e->getMessage());
+       }
+       else
+               printException ($e);
 }
 ?>