Handle exceptions during initialization better [MAILPOET-966]

This commit is contained in:
stoletniy
2017-06-27 18:29:57 +03:00
committed by pavel-mailpoet
parent a4282b6a3e
commit d3db755489
2 changed files with 39 additions and 2 deletions

View File

@@ -193,8 +193,16 @@ class Initializer {
}
function setupHooks() {
$hooks = new Hooks();
$hooks->init();
if(!$this->plugin_initialized) {
return;
}
try {
$hooks = new Hooks();
$hooks->init();
} catch(\Exception $e) {
$this->handleFailedInitialization($e);
}
}
function setupJSONAPI() {
@@ -224,6 +232,7 @@ class Initializer {
}
function handleFailedInitialization($message) {
Menu::addErrorPage();
return WPNotice::displayError($message);
}
}