r74999 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74998‎ | r74999 | r75000 >
Date:04:49, 19 October 2010
Author:neilk
Status:ok (Comments)
Tags:
Comment:
followup to r74701, better error message
Modified paths:
  • /branches/uploadwizard/extensions/UploadWizard/ApiQueryStashImageInfo.php (modified) (history)
  • /branches/uploadwizard/phase3/includes/api/ApiBase.php (modified) (history)

Diff [purge]

Index: branches/uploadwizard/phase3/includes/api/ApiBase.php
@@ -1012,6 +1012,7 @@
10131013
10141014 // uploadMsgs
10151015 'invalid-session-key' => array( 'code' => 'invalid-session-key', 'info' => 'Not a valid session key' ),
 1016+ 'invalidsessiondata' => array( 'code' => 'invalidsessiondata', 'info' => 'Session data for that key was bad or illegal' ),
10161017 'nouploadmodule' => array( 'code' => 'nouploadmodule', 'info' => 'No upload module set' ),
10171018 'uploaddisabled' => array( 'code' => 'uploaddisabled', 'info' => 'Uploads are not enabled. Make sure $wgEnableUploads is set to true in LocalSettings.php and the PHP ini setting file_uploads is true' ),
10181019 'copyuploaddisabled' => array( 'code' => 'copyuploaddisabled', 'info' => 'Uploads by URL is not enabled. Make sure $wgAllowCopyUploads is set to true in LocalSettings.php.' ),
Index: branches/uploadwizard/extensions/UploadWizard/ApiQueryStashImageInfo.php
@@ -54,9 +54,9 @@
5555 } catch ( SessionStashNotAvailableException $e ) {
5656 $this->dieUsage( "Session not available: " . $e->getMessage(), "nosession" );
5757 } catch ( SessionStashFileNotFoundException $e ) {
58 - $this->dieUsage( "File not found: " . $e->getMessage(), "nosuchpageid" );
 58+ $this->dieUsage( "File not found: " . $e->getMessage(), "invalidsessiondata" );
5959 } catch ( SessionStashBadPathException $e ) {
60 - $this->dieUsage( "Bad path: " . $e->getMessage(), "nosuchpageid" );
 60+ $this->dieUsage( "Bad path: " . $e->getMessage(), "invalidsessiondata" );
6161 }
6262
6363 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r75569followup to r74999, removing unnecessary messsage map entryneilk19:52, 27 October 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r74701better error reporting in exceptions; making getDescriptionUrl for SessionSta...neilk00:13, 13 October 2010

Comments

#Comment by Catrope (talk | contribs)   15:57, 20 October 2010

You're confusing dieUsage() and dieUsageMsg().

dieUsage($desc, $code) throws an error with exactly that code and description, without consulting the message map. The message map is only there for dieUsageMsg(array($key, $param1, $param2, ...)) to translate $key to a code-description pair and substitute parameters in that.

Status & tagging log