API: Throwing a more specific error message when the client tries to create empty...
authorRoan Kattouw <catrope@users.mediawiki.org>
Tue, 26 Aug 2008 20:40:44 +0000 (20:40 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Tue, 26 Aug 2008 20:40:44 +0000 (20:40 +0000)
RELEASE-NOTES
includes/api/ApiBase.php
includes/api/ApiEditPage.php

index 896ea46..8d79e71 100644 (file)
@@ -176,6 +176,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   for consistency with other list modules.
 * Added action=watch
 * (bug 15275) apprefix and related parameters ignore spaces at the end
+* action=edit no longer throws unknown error 228  when trying to create an empty
+  section with section=new
 
 === Languages updated in 1.14 ===
 
index 9f66869..86aae57 100644 (file)
@@ -665,6 +665,7 @@ abstract class ApiBase {
                'editconflict' => array('code' => 'editconflict', 'info' => "Edit conflict detected"),
                'hashcheckfailed' => array('code' => 'badmd5', 'info' => "The supplied MD5 hash was incorrect"),
                'missingtext' => array('code' => 'notext', 'info' => "One of the text, appendtext and prependtext parameters must be set"),
+               'emptynewsection' => array('code' => 'emptynewsection', 'info' => 'Creating empty new sections is not possible.'),
        );
 
        /**
index e9d3e1e..56416d8 100644 (file)
@@ -200,7 +200,8 @@ class ApiEditPage extends ApiBase {
                        case EditPage::AS_CONFLICT_DETECTED:
                                $this->dieUsageMsg(array('editconflict'));
                        #case EditPage::AS_SUMMARY_NEEDED: Can't happen since we set wpIgnoreBlankSummary
-                       #case EditPage::AS_TEXTBOX_EMPTY: Can't happen since we don't do sections
+                       case EditPage::AS_TEXTBOX_EMPTY:
+                               $this->dieUsageMsg(array('emptynewsection'));
                        case EditPage::AS_END:
                                # This usually means some kind of race condition
                                # or DB weirdness occurred. Throw an unknown error here.