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:
@@ -8,7 +8,14 @@ final class PhabricatorEventEngine {
|
|||||||
public static function initialize() {
|
public static function initialize() {
|
||||||
$listeners = PhabricatorEnv::getEnvConfig('events.listeners');
|
$listeners = PhabricatorEnv::getEnvConfig('events.listeners');
|
||||||
foreach ($listeners as $listener) {
|
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.
|
// Register the DarkConosole event logger.
|
||||||
|
|||||||
Reference in New Issue
Block a user