Handle exceptions during initialization better [MAILPOET-966]
This commit is contained in:
committed by
pavel-mailpoet
parent
a4282b6a3e
commit
d3db755489
@@ -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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user