示例#1
0
 public static function displayError($exception)
 {
     switch (get_class($exception)) {
         case 'PDOException':
             self::$header = 'Database error';
             break;
         case 'Exception':
         default:
             self::$header = 'Application error';
             break;
     }
     // end switch
     $output = '';
     // Display Exception trace
     $output .= self::getFormatedTrace($exception);
     // Header
     $output .= '<table>';
     $output .= "<tr> <th colspan='2'>" . self::$header . "</th> \n </tr> \n";
     // Exception details
     $output .= "<tr> <td width='200'><b>File</b> </td> <td>" . $exception->getFile() . "</td> \n</tr> \n";
     $output .= "<tr> <td><b>Line</b> </td> <td>" . $exception->getLine() . "</td> \n </tr> \n";
     $output .= "<tr> <td><b>Exception code</b> </td> <td>" . $exception->getCode() . "</td> \n </tr> \n";
     $output .= "<tr> <td><b>Exception message</b> </td> <td>" . $exception->getMessage() . "</td> \n </tr> \n";
     $output .= "<tfoot> \n <tr> \n";
     $output .= "<td colspan='2'> \n";
     $output .= "Have you tried to run the <a href='test.php'>test page</a> ?<br />";
     $output .= "Check the online documentation on <a href='http://www.bacula-web.org' target='_blank'>Bacula-Web project site</a> <br />";
     $output .= "Rebort a bug or suggest a new feature in the <a href='http://bugs.bacula-web.org' target='_blank'>Bacula-Web\\'s bugtracking tool</a> <br />";
     $output .= "</td> \n";
     $output .= " \n</tr> \n </tfoot>";
     $output .= "</table>";
     echo $output;
     //die();
 }