Skip to content

Commit

Permalink
Issue #84 Throw exception for the empty new cmid (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomoTsuyuki authored Jan 11, 2024
1 parent 692919f commit e230327
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions classes/massactionutils.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ public static function duplicate_cm_to_course(object $course, object $cm): int {
}
}
}
if (empty($newcmid)) {
throw new \moodle_exception('Could not duplicate course module from id ' . $cm->id);
}
return $newcmid;
}
}

0 comments on commit e230327

Please sign in to comment.