Commit graph

7 commits

Author SHA1 Message Date
Timo Tijhof
b706fa4ac1 exception: Create generic BadRequestError based on ErrorPageError
Ideally this would be an option in ErrorPageError (perhaps even the default),
but its constructor isn't very suitable for that.

After this lands, uses of ErrorPageError should be audited to see if it makes
sense to emit a 400 status code.

Change-Id: I4beb6a4f256446b98b66d5e4bcdbab8f247441a8
2016-05-19 18:59:15 +00:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Brad Jorsch
132f1b1ea8 MalformedTitleException should call parent::__construct
There's no reason for $ex->getMessage() to return nothing. Do like
ErrorPageError does and get the default English message for the parent.

Also move the appending of $titleText to $errorMessageParameters into
MalformedTitleException itself and document it, so every catcher of the
exception doesn't need to know about this, and fix the check so it
doesn't screw up for title "0".

Change-Id: I43d988602b847b67a3cf0aa84e271a0b5bd9adae
2015-05-06 16:11:51 -04:00
Bartosz Dziewoński
708918ccbf Provide detailed information about invalid titles
includes/Title.php
* The private method Title::secureAndSplit() now throws a
  MalformedTitleException instead of returning false on invalid
  titles.
* Added Title::newFromTextThrow(), which behaves exactly like
  Title::newFromText() but throws MalformedTitleException instead of
  returning null on invalid titles.

includes/title/MediaWikiTitleCodec.php
* Provide more information with the thrown MalformedTitleExceptions.

includes/MediaWiki.php
* Use the new Title::newFromTextThrow() to get detailed error
  information, display it.

Change-Id: I4da8ecb457a77473e32d745ba48ab8505b35e45f
2015-04-30 23:50:07 +02:00
umherirrender
b883e8c7c0 Cleanup some docs (includes/[e-l])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I41a84e8e1dec39170aa655250325ffc485eaeaef
2014-07-24 19:43:03 +02:00
addshore
7a56bf8168 Add scope to Exception class methods
Change-Id: I0097aa9a6d9c178c85706b90484f7a68d3ddbc8b
2014-02-24 21:21:09 +01:00
addshore
557af13086 Split Exception.php
Change-Id: I8273b342f8814887b65227457d0a461d7cd31e75
2014-02-24 21:17:59 +01:00