Commit 46d6f644 authored by GROSS-AMBLARD David's avatar GROSS-AMBLARD David
Browse files

Adds a global try/catch block to handle any exception.

parent 09550713
......@@ -169,16 +169,16 @@ function step($conn, $artifactid, $from, $to, $guard, $actions)
$conn->query("update Artifact set node=$to where ID=$artifactid");
foreach ($actions as $action) {
debug("executing $action");
try {
// try {
$action=str_replace("CURRENT_ARTIFACT",$artifactid, $action);
if($action=="PIGNISTIC")
pignistic($conn,$artifactid);
else
$conn->query($action);
} catch (PDOException $e) {
echo "<p>Headache ! <pre>$e</pre></p>";
exit;
}
// } catch (PDOException $e) {
// echo "<p>Headache ! <pre>$e</pre></p>";
// exit;
// }
}
}
......
......@@ -26,11 +26,13 @@
<h2>Powered by</h2>
<ul class='creditlist'>
<li>First-order logic
<li>Business artifacts
<li>Tuple artifacts
<li>Bootstrap
<li>Apache
<li>PHP
<li>MySQL
<li>Python
<li>Java
<li>Javascript</li>
<li>Cytoscape.js</li>
</ul>
......@@ -12,7 +12,6 @@
* MAIN: the main part of the Web page
*/
require("HWlib.php");
require("HTML.php");
require("profile.php");
......@@ -24,9 +23,10 @@ require("show-pages.php");
require("artifacts.php");
require("show-artifact.php");
session_start();
try { // grobal exception catcher
@debug("Session id: ".$_SESSION['id']);
@debug("GET parameter: project ".$_GET['project']);
@debug("Session project: ".$_SESSION['project']);
......@@ -202,3 +202,23 @@ if (isset($_SESSION['username'])) {
require("template-main.php");
}
catch (Exception $e){ // global exception handler
$message=$e->getMessage();
$trace=$e->getTraceAsString();
echo "
<div class='alert alert-danger' role='alert'>
<h1>Headache !</h1>
<p>Sorry, we got an internal error. We are on it.</p>
<h2>Details</h2>
<p>$message</p>
<code>";
print_r($e->getTrace());
echo "
</code>
</div>";
exit;
}
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment