Mojo: Make the shell's loader log URL fetch errors.

This is to help debugging and make various failures less mysterious.

R=darin@chromium.org, abarth@chromium.org

Review URL: https://codereview.chromium.org/132283003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243976 0039d316-1c4b-4281-b951-d872f2087c98
parent 86df12e2
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "mojo/shell/switches.h" #include "mojo/shell/switches.h"
#include "net/base/load_flags.h" #include "net/base/load_flags.h"
#include "net/base/network_delegate.h" #include "net/base/network_delegate.h"
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_request_status.h"
namespace mojo { namespace mojo {
namespace shell { namespace shell {
...@@ -25,6 +27,15 @@ Loader::Job::~Job() { ...@@ -25,6 +27,15 @@ Loader::Job::~Job() {
} }
void Loader::Job::OnURLFetchComplete(const net::URLFetcher* source) { void Loader::Job::OnURLFetchComplete(const net::URLFetcher* source) {
net::URLRequestStatus status = source->GetStatus();
if (!status.is_success()) {
LOG(ERROR) << "URL fetch didn't succeed: status = " << status.status()
<< ", error = " << status.error();
} else if (source->GetResponseCode() != 200) {
LOG(ERROR) << "HTTP response not OK: code = " << source->GetResponseCode();
}
// TODO: Do something else in the error cases?
base::FilePath app_path; base::FilePath app_path;
source->GetResponseAsFilePath(true, &app_path); source->GetResponseAsFilePath(true, &app_path);
delegate_->DidCompleteLoad(source->GetURL(), app_path); delegate_->DidCompleteLoad(source->GetURL(), app_path);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment