MDL-65071 forum: Error handling in web service when forum does not exist
authorMihail Geshoski <mihail@moodle.com>
Thu, 2 May 2019 05:51:14 +0000 (13:51 +0800)
committerMihail Geshoski <mihail@moodle.com>
Thu, 2 May 2019 05:51:14 +0000 (13:51 +0800)
mod/forum/externallib.php
version.php

index 4757cf3..258c8ad 100644 (file)
@@ -830,6 +830,9 @@ class mod_forum_external extends external_api {
 
         $forumvault = $vaultfactory->get_forum_vault();
         $forum = $forumvault->get_from_id($forumid);
+        if (!$forum) {
+            throw new \moodle_exception("Unable to find forum with id {$forumid}");
+        }
         $forumdatamapper = $legacydatamapperfactory->get_forum_data_mapper();
         $forumrecord = $forumdatamapper->to_legacy_object($forum);
 
index e838d63..67f62b4 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2019050100.00;              // YYYYMMDD      = weekly release date of this DEV branch.
+$version  = 2019050100.01;              // YYYYMMDD      = weekly release date of this DEV branch.
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.