1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 13:30:55 +01:00

Log and continue when trying to register an invalid event listener

Summary: We currently die if an event listener throws when registering (e.g., because it is misconfigured), but this prevents you from running `bin/config` to fix it, which is a bit silly.

Test Plan: Created this revision with an invalid listener in config.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6761
This commit is contained in:
epriestley 2013-08-14 19:14:16 -07:00
parent 3d8eb641ea
commit 13d18376c1

View file

@ -8,7 +8,14 @@ final class PhabricatorEventEngine {
public static function initialize() {
$listeners = PhabricatorEnv::getEnvConfig('events.listeners');
foreach ($listeners as $listener) {
id(new $listener())->register();
try {
id(new $listener())->register();
} catch (Exception $ex) {
// If the listener does not exist, or throws when registering, just
// log it and continue. In particular, this is important to let you
// run `bin/config` in order to remove an invalid listener.
phlog($ex);
}
}
// Register the DarkConosole event logger.