Skip to content
Snippets Groups Projects
Commit 9ba259be authored by Alex Pott's avatar Alex Pott
Browse files

Issue #1788610 by chertzog, fjd, brainbender: Hook_update_N has unreachable UpdateException.

parent 28077fa5
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -2584,12 +2584,14 @@ function hook_update_N(&$sandbox) { ...@@ -2584,12 +2584,14 @@ function hook_update_N(&$sandbox) {
$sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']);
if ($some_error_condition_met) {
// In case of an error, simply throw an exception with an error message.
throw new UpdateException('Something went wrong; here is what you should do.');
}
// To display a message to the user when the update is completed, return it. // To display a message to the user when the update is completed, return it.
// If you do not want to display a completion message, simply return nothing. // If you do not want to display a completion message, simply return nothing.
return t('The update did what it was supposed to do.'); return t('The update did what it was supposed to do.');
// In case of an error, simply throw an exception with an error message.
throw new UpdateException('Something went wrong; here is what you should do.');
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment