Skip to content

Commit 3af0d82

Browse files
committed
fix(Install): show an error on install or upgrade failure
1 parent 2053c88 commit 3af0d82

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

hook.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,16 @@ function plugin_carbon_install(array $args = []): bool
8080
// do not output messages
8181
ob_start();
8282
}
83-
if ($version === '0.0.0') {
84-
$success = $install->install($args);
85-
} else {
86-
$success = $install->upgrade($version, $args);
83+
try {
84+
if ($version === '0.0.0') {
85+
$success = $install->install($args);
86+
} else {
87+
$success = $install->upgrade($version, $args);
88+
}
89+
} catch (\RuntimeException $e) {
90+
$error_footer = '<br />' . __('Please check the logs for more details. Fill an issue in the repository of the plugin.', 'carbon');
91+
Session::addMessageAfterRedirect($e->getMessage() . $error_footer, false, ERROR);
92+
$success = false;
8793
}
8894

8995
if ($silent) {

0 commit comments

Comments
 (0)