Commit graph

2 commits

Author SHA1 Message Date
daniel
13acba25a0 REST: gracefully handle all exceptions.
ResponseFactory::createFromException already had support for arbitrary
exceptions, but Router was so far only using it for HttpExceptions,
leaving other kinds of exceptions uncaught.

In addition to catching all exceptions and generating an appropriate
JSON response for them, this patch introduces the ErrorReporter
interface, with an MWErrorReporter implementation which calls
MWExceptionHandler::rollbackMasterChangesAndLog(). This is how uncaught
errors are handled for requests coming in via api.php, so it seems
appropriate to use the same approach for requests coming in via
rest.php.

Bug: T285984
Change-Id: I0605a7693821ef58fac80ab67f51a742556a37fd
2021-11-02 20:33:13 +01:00
DannyS712
12ffb90aa8 Convert MWBasicRequestAuthorizerTest to a unit test
Already essentially a unit test, does not use any integration

Change-Id: I705c9e5fb04103f305e26b7cd677cf68fc7b73b5
2021-04-23 23:35:09 +00:00
Renamed from tests/phpunit/includes/Rest/BasicAccess/MWBasicRequestAuthorizerTest.php (Browse further)