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.