API: Catch Errors as well as Exceptions
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 21 Aug 2018 15:19:15 +0000 (11:19 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 22 Aug 2018 13:30:06 +0000 (09:30 -0400)
commite6a75d806b91f29573c0038d1d64cd64dcbe09a6
tree73ec58a72d0c4a046182593d4384f8dad4b8a850
parentf7e3ee20bb0384ff81752df8e53beca07c339304
API: Catch Errors as well as Exceptions

ApiMain (and also api.php) tries to catch any Exception so as to provide
a properly-formatted error message to the client instead of an HTML
error page.

With PHP 7.0, some cases that produce an Exception in HHVM instead
produce an Error. The API code should catch these too.

Fortunately neither Zend PHP nor HHVM care if you try to catch a class
that doesn't exist, so we can just add catch blocks for Throwable and
not worry about it.

Bug: T202416
Change-Id: I189eee466bd09870bc172f2420be393a7c0b1900
api.php
includes/api/ApiMain.php