Moodle
  1. Moodle
  2. MDL-37654

The function course_delete_module should return an untranslated errorcode for the exceptions for the web service.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: None
    • Component/s: Course
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a course module.
      2. Edit the function course_delete_module in course/lib.php by copying the first occurrence of "throw new exception ..." in this issues diff and placing it after the declaration of $modulename.
      3. Attempt to delete the module and ensure exception is thrown as expected.
      4. Replace this "throw new exception ..." with the next one and continue until you have gone through all of them in this diff.
      5. Remove the changes you have done from course/lib.php and ensure you can delete the module instance.
      Show
      Create a course module. Edit the function course_delete_module in course/lib.php by copying the first occurrence of "throw new exception ..." in this issues diff and placing it after the declaration of $modulename. Attempt to delete the module and ensure exception is thrown as expected. Replace this "throw new exception ..." with the next one and continue until you have gone through all of them in this diff. Remove the changes you have done from course/lib.php and ensure you can delete the module instance.
    • Affected Branches:
      MOODLE_25_STABLE
    • Pull Master Branch:
      MDL-37654_master
    • Rank:
      47351

      Description

      The web services depend on an error code to be returned when an exception is thrown, it is not logical to pass a string that will vary depending on the module being used. Return an error code so it will be the same regardless of module.

        Issue Links

          Activity

          Hide
          Mark Nelson added a comment -

          I also introduced another logic check here, to ensure the function exists before calling it to avoid a PHP error.

          Show
          Mark Nelson added a comment - I also introduced another logic check here, to ensure the function exists before calling it to avoid a PHP error.
          Hide
          Jérôme Mouneyrac added a comment - - edited

          fine to me sending to integration. Thanks Mark.

          Show
          Jérôme Mouneyrac added a comment - - edited fine to me sending to integration. Thanks Mark.
          Hide
          Damyon Wiese added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          Cheers!

          Show
          Damyon Wiese added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. Cheers!
          Hide
          Damyon Wiese added a comment -

          Thanks Mark,

          This has been pushed to master only.

          I think you should probably remove this "Ensure they all make sense" from step 4 of the testing instructions as it's a bit vague.

          Show
          Damyon Wiese added a comment - Thanks Mark, This has been pushed to master only. I think you should probably remove this "Ensure they all make sense" from step 4 of the testing instructions as it's a bit vague.
          Hide
          Adrian Greeve added a comment -

          Tested on the master integration branch.
          All the appropriate exceptions were thrown.
          Test passed.

          Show
          Adrian Greeve added a comment - Tested on the master integration branch. All the appropriate exceptions were thrown. Test passed.
          Hide
          Damyon Wiese added a comment -

          Congratulations this fix has been added to Moodle!

          You may want to dedicate this issue to someone special on this Valentines day.

          Thanks!

          Show
          Damyon Wiese added a comment - Congratulations this fix has been added to Moodle! You may want to dedicate this issue to someone special on this Valentines day. Thanks!

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: