Skip to content

Commit

Permalink
Issue #84 Throw exception for the empty new cmid
Browse files Browse the repository at this point in the history
  • Loading branch information
TomoTsuyuki committed Oct 25, 2023
1 parent 96038c1 commit 9272fbc
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 9272fbc

Please sign in to comment.