/**
  * Include messages from a Status object in the API call's output.
  *
  * An ApiErrorHandler is used to report the status, if necessary.
  * If $status->isOK() is false, this method will terminate with a UsageException.
  *
  * @param Status $status The status to report
  * @param string  $errorCode The API error code to use in case $status->isOK() returns false
  * @param array   $extradata Additional data to include the the error report,
  *                if $status->isOK() returns false
  * @param int     $httpRespCode the HTTP response code to use in case
  *                $status->isOK() returns false.+
  *
  * @throws UsageException If $status->isOK() returns false.
  */
 private function handleStatus(Status $status, $errorCode, array $extradata = array(), $httpRespCode = 0)
 {
     if ($status->isGood()) {
         return;
     } elseif ($status->isOK()) {
         $this->errorReporter->reportStatusWarnings($status);
     } else {
         $this->errorReporter->reportStatusWarnings($status);
         $this->errorReporter->dieStatus($status, $errorCode, $httpRespCode, $extradata);
     }
 }
 /**
  * @dataProvider statusProvider
  */
 public function testDieStatus(Status $status, $code, $httpStatusCode, array $extradata = null, $infoPattern, array $expectedDataFields)
 {
     $api = new ApiMain();
     $localizer = $this->getExceptionLocalizer();
     $reporter = new ApiErrorReporter($api, $localizer, Language::factory('de'));
     try {
         $reporter->dieStatus($status, $code, $httpStatusCode, $extradata);
         $this->fail('UsageException was not thrown!');
     } catch (UsageException $ex) {
         $this->assertUsageException($infoPattern, $code, $httpStatusCode, $expectedDataFields, $ex);
     }
 }