From: Roan Kattouw Date: Tue, 26 Aug 2008 20:40:44 +0000 (+0000) Subject: API: Throwing a more specific error message when the client tries to create empty... X-Git-Tag: 1.31.0-rc.0~45641 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=1d3b95ab8d483db31e84253d90808819ecb3c1ab;p=lhc%2Fweb%2Fwiklou.git API: Throwing a more specific error message when the client tries to create empty new sections, which isn't allowed. Unknown error: ``228'' isn't very user-friendly. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 896ea46f4b..8d79e711b4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 9f66869b00..86aae574b0 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -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.'), ); /** diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index e9d3e1e0f0..56416d8695 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -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.