Exception.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <style type="text/css">
  2. .system_error {
  3. border:1px solid #990000;
  4. padding:10px 20px;
  5. margin:10px;
  6. font: 13px/1.4em verdana;
  7. background: #fff;
  8. }
  9. code.source {
  10. white-space: pre;
  11. background: #fff;
  12. padding: 1em;
  13. display: block;
  14. margin: 1em 0;
  15. border: 1px solid #bedbeb;
  16. }
  17. .system_error .box {
  18. margin: 1em 0;
  19. background: #ebf2fa;
  20. padding: 10px;
  21. border: 1px solid #bedbeb;
  22. }
  23. code.source em {background: #ffc;}
  24. </style>
  25. <div class="system_error">
  26. <b style="color: #990000"><?php echo get_class($exception); ?></b>
  27. <p><?php echo $exception->getMessage(); ?></p>
  28. <?php
  29. $x = FALSE;
  30. if($backtrace = $exception->getTrace())
  31. {
  32. foreach($backtrace as $id => $line)
  33. {
  34. if(!isset($line['file'],$line['line']))continue;
  35. $x = TRUE;
  36. print '<div class="box">';
  37. //Skip the first element
  38. if( $id !== 0 )
  39. {
  40. // If this is a class include the class name
  41. print '<b>Called by '. (isset($line['class']) ? $line['class']. $line['type'] : '');
  42. print $line['function']. '()</b>';
  43. }
  44. // Print file, line, and source
  45. print ' in '. $line['file']. ' ['. $line['line']. ']';
  46. print '<code class="source">'. \Micro\Error::source($line['file'], $line['line']). '</code>';
  47. if(isset($line['args']))
  48. {
  49. print '<b>Function Arguments</b>';
  50. print dump($line['args']);
  51. }
  52. print '</div>';
  53. }
  54. }
  55. if(!$x)
  56. {
  57. print '<p><b>'.$exception->getFile().'</b> ('.$exception->getLine().')</p>';
  58. }
  59. ?>
  60. </div>