Allow a greater variety of status codes to be handled by
HttpException, including 204 and 304 ("no content" and "not modified")
as well as 301, 302, 303, 304, and 307 (redirects, via a new
RedirectException subclass). This allows for a greater variety of
"exceptional conditions" to be handled by throwing, avoiding the need
for checking error codes all the way up a deeply nested call stack.
For cases which still aren't covered, we allow wrapping a full
Response object as an exception. This allows the same basic exception
mechanism to be used, even if sometimes you need a custom status code
or custom headers.
See I800a3fe5160a9d7fc3fddbb445ec61cc5390b14f for a sample use case
from the Parsoid REST handler implementation.
Bug: T260959
Change-Id: I5a00ba8fbc90aa266a6d77f15e8e398be5463ff4
Add public, protected or private to function missing a visibility
Enable the tests folder for the phpcs sniff
Change-Id: Ibefce76ea9984c47e08c94889ea2eafca7565e2c
* Add ResponseFactory::createLocalizedHttpError(), which generates a
JSON response body from a MessageValue
* ResponseFactory::__construct() accepts an array of TextFormatter
objects. For ease of testing, the array may be empty. The integrated
ResponseFactory has a TextFormatter for English, and one for
$wgContLang if that is different.
* Use createLocalizedHttpError() to show helpful error messages for
errors generated by Router.
Change-Id: I897a0aee42227916c568333ab384966f1b87f599