Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
44c07e9b
Commit
44c07e9b
authored
May 12, 2012
by
Nathaniel Catchpole
Browse files
Issue
#1545068
by Berdir: Convert Exception in update.inc to
PSR-0
.
parent
c01dafd6
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/includes/update.inc
View file @
44c07e9b
...
...
@@ -321,9 +321,11 @@ function update_module_enable(array $modules) {
* will be displayed at all.
*
* If it fails for whatever reason, it should throw an instance of
* DrupalUpdateException with an appropriate error message, for example:
* Drupal\Core\Utility\UpdateException with an appropriate error message, for
* example:
* @code
* throw new DrupalUpdateException(t('Description of what went wrong'));
* use Drupal\Core\Utility\UpdateException;
* throw new UpdateException(t('Description of what went wrong'));
* @endcode
*
* If an exception is thrown, the current update and all updates that depend on
...
...
@@ -403,11 +405,6 @@ function update_do_one($module, $number, $dependency_map, &$context) {
$context
[
'message'
]
=
'Updating '
.
check_plain
(
$module
)
.
' module'
;
}
/**
* @class Exception class used to throw error if a module update fails.
*/
class
DrupalUpdateException
extends
Exception
{
}
/**
* Start the database update batch process.
*
...
...
core/lib/Drupal/Core/Utility/UpdateException.php
0 → 100644
View file @
44c07e9b
<?php
/*
* @file
* Definition of Drupal\Core\Utility\UpdateException.
*/
namespace
Drupal\Core\Utility
;
/**
* Exception class used to throw error if a module update fails.
*/
class
UpdateException
extends
Exception
{
}
core/modules/system/system.api.php
View file @
44c07e9b
...
...
@@ -5,6 +5,8 @@
* Hooks provided by Drupal core and the System module.
*/
use
Drupal\Core\Utility\UpdateException
;
/**
* @addtogroup hooks
* @{
...
...
@@ -2968,10 +2970,11 @@ function hook_install() {
* @param $sandbox
* Stores information for multipass updates. See above for more information.
*
* @throws DrupalUpdateException, PDOException
* In case of error, update hooks should throw an instance of DrupalUpdateException
* with a meaningful message for the user. If a database query fails for whatever
* reason, it will throw a PDOException.
* @throws Drupal\Core\Utility\UpdateException, PDOException
* In case of error, update hooks should throw an instance of
* Drupal\Core\Utility\UpdateException with a meaningful message for the user.
* If a database query fails for whatever reason, it will throw a
* PDOException.
*
* @return
* Optionally update hooks may return a translated string that will be displayed
...
...
@@ -3022,7 +3025,7 @@ function hook_update_N(&$sandbox) {
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
Drupal
UpdateException('Something went wrong; here is what you should do.');
throw
new
UpdateException
(
'Something went wrong; here is what you should do.'
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment