Skip to content

Commit 546e457

Browse files
committed
Update class_event.php
1 parent acf9797 commit 546e457

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

class_event.php

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ class EventDispatcher {
1717
public static $events;
1818
public static $current_event;
1919
public static $happened_events;
20+
21+
private $error_message = '';
2022

2123

2224
private function __construct()
@@ -110,20 +112,22 @@ public function doDispatch($name, $arguments = "")
110112
// run Listener and store the value returned by registered functions
111113
if ( function_exists($action['function']) )
112114
{
113-
115+
114116
$return_arguments = call_user_func_array($action['function'], array(&$arguments));
115-
117+
116118
if ( $return_arguments )
117119
{
118120
$arguments = $return_arguments;
119121
}
120-
122+
121123
// Store called Listeners
122124
self::$happened_events[$name][$priority] = $action['function'];
123125
}
124126
else {
125-
126-
//die('Function ' . $action['function'] . ' not found');
127+
128+
$this->error_message = 'Event Dispatcher: Function "' . $action['function'] . '" not found. (' . $name . ')';
129+
130+
$this->hasError();
127131
}
128132
}
129133
}
@@ -223,7 +227,13 @@ public static function debug()
223227
print_r(self::$happened_events);
224228
echo "</pre>";
225229
}
226-
}
230+
}
231+
232+
private function hasError() {
233+
234+
die($this->error_message);
235+
}
236+
227237
}
228238

229239
/**

0 commit comments

Comments
 (0)