MDL-74484 lib: Final deprecation of print_error

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
This commit is contained in:
Daniel Ziegenberg 2024-03-27 20:16:48 +01:00
parent c895def59b
commit 0cca112259
No known key found for this signature in database
GPG Key ID: 7E6F98FFADBEFD39
2 changed files with 13 additions and 16 deletions

View File

@ -2872,24 +2872,16 @@ function get_array_of_activities() {
}
/**
* Abort execution by throwing of a general exception,
* default exception handler displays the error message in most cases.
*
* @deprecated since Moodle 4.1
* @todo MDL-74484 Final deprecation in Moodle 4.5.
* @param string $errorcode The name of the language string containing the error message.
* Normally this should be in the error.php lang file.
* @param string $module The language file to get the error message from.
* @param string $link The url where the user will be prompted to continue.
* If no url is provided the user will be directed to the site index page.
* @param object $a Extra words and phrases that might be required in the error string
* @param string $debuginfo optional debugging information
* @return void, always throws exception!
*/
function print_error($errorcode, $module = 'error', $link = '', $a = null, $debuginfo = null) {
debugging("The function print_error() is deprecated. " .
"Please throw a new moodle_exception instance instead.", DEBUG_DEVELOPER);
throw new \moodle_exception($errorcode, $module, $link, $a, $debuginfo);
#[\core\attribute\deprecated(
'Please throw a new moodle_exception instance instead.',
since: '4.1',
mdl: 'MDL-71062',
final: true
)]
function print_error(): void {
\core\deprecation::emit_deprecation_if_present([__FUNCTION__]);
}
/**

View File

@ -1,6 +1,11 @@
This files describes API changes in core libraries and APIs,
information provided here is intended especially for developers.
=== 4.5 ===
* Final deprecation of print_error(). Use moodle_exception instead.
=== 4.4 ===
* New modinfo methods related to delegated sections (sections controlled by a component):