Skip to content

Commit

Permalink
MBS-7391: Replace the deprecated print_error by moodle exception
Browse files Browse the repository at this point in the history
  • Loading branch information
PM84 committed Mar 2, 2023
1 parent c9187c6 commit 4189b34
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backup/moodle2/restore_format_topcoll_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function process_topcoll($data) {
$data->courseid = $this->task->get_courseid();

if (!($course = $DB->get_record('course', array('id' => $data->courseid)))) {
print_error('invalidcourseid', 'error');
throw new \moodle_exception('invalidcourseid', 'error');
} // From /course/view.php.
$courseformat = course_get_format($course);

Expand Down
2 changes: 1 addition & 1 deletion classes/output/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ public function single_section_page($displaysection) {
if (!($thissection = $modinfo->get_section_info($displaysection))) {
/* This section doesn't exist or is not available for the user.
We actually already check this in course/view.php but just in case exit from this function as well. */
print_error('unknowncoursesection', 'error', course_get_url($course),
throw new \moodle_exception('unknowncoursesection', 'error', course_get_url($course),
format_string($course->fullname));
}

Expand Down
4 changes: 2 additions & 2 deletions settopcollpref.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@
// Get the name of the preference to update, and check that it is allowed.
$name = required_param('pref', PARAM_RAW);
if (!isset($USER->ajax_updatable_user_prefs[$name])) {
print_error('notallowedtoupdateprefremotely');
throw new \moodle_exception('notallowedtoupdateprefremotely');
}

// Get and set the value.
$value = \format_topcoll\togglelib::required_topcoll_param('value');
// Update.
if ($value) {
if (!set_user_preference($name, $value)) {
print_error('errorsettinguserpref');
throw new \moodle_exception('errorsettinguserpref');
}
echo 'OK';
} else {
Expand Down

0 comments on commit 4189b34

Please sign in to comment.