1 <?php
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 class MagratheaException extends Exception {
22 public function __construct($message = "Magrathea has failed... =(", $code = 0, Exception $previous = null) {
23 $this->message = $message;
24 MagratheaDebugger::Instance()->Add($this);
25 parent::__construct($message, $code, $previous);
26 }
27
28 public $killerError = true;
29
30 public function __toString() {
31 return get_class($this).": {".$this->message."}\n@ ".$this->getFile().":".$this->getLine();
32 }
33
34 public function display(){
35 echo "MAGRATHEA ERROR! <br/>";
36 echo $this->message;
37 }
38 }
39
40 class MagratheaAdminException extends MagratheaException {
41 public function __construct($message = "Magrathea Admin Error", $code = 0, Exception $previous = null) {
42 parent::__construct($message, $code, $previous);
43 }
44 }
45
46 class MagratheaConfigException extends MagratheaException {
47 public function __construct($message = "Magrathea Config has failed... =(", $code = 0, Exception $previous = null) {
48 parent::__construct($message, $code, $previous);
49 }
50 }
51
52 class MagratheaDBException extends MagratheaException {
53 private $query = null;
54 public function __construct($message = "Magrathea Database has failed... =(", $code = 0, Exception $previous = null) {
55 parent::__construct($message, $code, $previous);
56 }
57 }
58
59 class MagratheaModelException extends MagratheaException {
60 public function __construct($message = "Error in Magrathea Model", $code = 0, Exception $previous = null) {
61 parent::__construct($message, $code, $previous);
62 }
63 }
64
65 class MagratheaViewException extends MagratheaException {
66 public function __construct($message = "Error in Magrathea Model", $code = 0, Exception $previous = null) {
67 parent::__construct($message, $code, $previous);
68 }
69 }
70
71
72 class MagratheaControllerException extends MagratheaException {
73 public function __construct($message = "Error in Magrathea Control", $code = 0, Exception $previous = null) {
74 parent::__construct($message, $code, $previous);
75 }
76 }
77
78
79