Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ReportUtilsDelegate.php with more reasonable error #176

Merged
merged 2 commits into from
Oct 24, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private static function DownloadReportFromUrl($url, $headers, $params,
}

$response = $curlUtils->Exec($ch);
$error = $curlUtils->Error($ch);
$curlError = $curlUtils->Error($ch);
$code = $curlUtils->GetInfo($ch, CURLINFO_HTTP_CODE);
$downloadSize = $curlUtils->GetInfo($ch, CURLINFO_SIZE_DOWNLOAD);
$request = $curlUtils->GetInfo($ch, CURLINFO_HEADER_OUT);
Expand Down Expand Up @@ -178,8 +178,9 @@ private static function DownloadReportFromUrl($url, $headers, $params,
} else if (!empty($error)) {
$exception = new ReportDownloadException($error);
} else if (isset($code)) {
$exception =
new ReportDownloadException('Report download failed.', $code);
$message = 'Report download failed. ';
!empty($curlError) && $message .= $curlError;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please use explicit if-clause to be consistent with the style of this library?

if (!empty($curlError)) {
  $message .= $curlError;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

$exception = new ReportDownloadException($message, $code);
}
}

Expand Down