Chromium Code Reviews| Index: components/ntp_snippets/ntp_snippets_fetcher.cc |
| diff --git a/components/ntp_snippets/ntp_snippets_fetcher.cc b/components/ntp_snippets/ntp_snippets_fetcher.cc |
| index c0eb082d9e8c6ae71c8623e7bf773a8914f66d78..fe4ae9850bae62d791e1d97e6d74c9ebd81afffb 100644 |
| --- a/components/ntp_snippets/ntp_snippets_fetcher.cc |
| +++ b/components/ntp_snippets/ntp_snippets_fetcher.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/files/file_path.h" |
| #include "base/files/file_util.h" |
| #include "base/path_service.h" |
| +#include "base/strings/string_number_conversions.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/task_runner_util.h" |
| @@ -110,25 +111,25 @@ void NTPSnippetsFetcher::FetchSnippets(const std::set<std::string>& hosts) { |
| void NTPSnippetsFetcher::OnURLFetchComplete(const URLFetcher* source) { |
| DCHECK_EQ(url_fetcher_.get(), source); |
| - const URLRequestStatus& status = source->GetStatus(); |
| - if (!status.is_success()) { |
| - DLOG(WARNING) << "URLRequestStatus error " << status.error() |
| - << " while trying to download " << source->GetURL().spec(); |
| - return; |
| - } |
| + std::string response; |
|
Marc Treib
2016/04/21 13:47:20
nit: Move the definition down to where it's actual
jkrcal
2016/04/22 09:30:28
Done.
|
| + std::string message; |
| - int response_code = source->GetResponseCode(); |
| - if (response_code != net::HTTP_OK) { |
| - DLOG(WARNING) << "HTTP error " << response_code |
| - << " while trying to download " << source->GetURL().spec(); |
| - return; |
| + const URLRequestStatus& status = source->GetStatus(); |
| + if (!status.is_success()) |
| + message = "URLRequestStatus error " + base::IntToString(status.error()); |
| + else if (source->GetResponseCode() != net::HTTP_OK) |
| + message = "HTTP error " + base::IntToString(source->GetResponseCode()); |
| + |
| + if (!message.empty()) { |
| + DLOG(WARNING) << message << " while trying to download " |
| + << source->GetURL().spec(); |
| + |
| + } else { |
| + bool stores_result_to_string = source->GetResponseAsString(&response); |
| + DCHECK(stores_result_to_string); |
| } |
| - std::string response; |
| - bool stores_result_to_string = source->GetResponseAsString(&response); |
| - DCHECK(stores_result_to_string); |
| - |
| - callback_list_.Notify(response); |
| + callback_list_.Notify(response, message); |
| } |
| } // namespace ntp_snippets |