Skip to content

Commit

Permalink
fix: added handling of exeption if exercise doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Joumoune committed Oct 9, 2024
1 parent dbbff08 commit c59745e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/controllers/exercise_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ function createExercise()

function deleteExercise($id)
{
$exercise = new Exercises($id);
try {
$exercise = new Exercises($id);
}
catch (Exception $e) {
lost();
return;
}

if ($exercise->getExerciseStatus() == Status::Building->value || $exercise->getExerciseStatus() == Status::Closed->value)
{
$exercise->delete();
Expand Down

0 comments on commit c59745e

Please sign in to comment.