Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2647)

Unified Diff: chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc

Issue 1360153003: Improve logging for PermissionRequestCreatorApiary errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc
diff --git a/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc b/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc
index 37483a124f2ce750983d568889ce7f3cfb1b9254..d9b6dc27f5cd321fb100553bd151db00196ce1bd 100644
--- a/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc
+++ b/chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.cc
@@ -199,7 +199,6 @@ void PermissionRequestCreatorApiary::OnGetTokenSuccess(
void PermissionRequestCreatorApiary::OnGetTokenFailure(
const OAuth2TokenService::Request* request,
const GoogleServiceAuthError& error) {
- VLOG(1) << "Couldn't get token";
RequestIterator it = requests_.begin();
while (it != requests_.end()) {
if (request == (*it)->access_token_request.get())
@@ -207,8 +206,8 @@ void PermissionRequestCreatorApiary::OnGetTokenFailure(
++it;
}
DCHECK(it != requests_.end());
- (*it)->callback.Run(false);
- requests_.erase(it);
+ LOG(WARNING) << "Token error: " << error.ToString();
+ DispatchResult(it, false);
}
void PermissionRequestCreatorApiary::OnURLFetchComplete(
@@ -223,7 +222,8 @@ void PermissionRequestCreatorApiary::OnURLFetchComplete(
const net::URLRequestStatus& status = source->GetStatus();
if (!status.is_success()) {
- DispatchNetworkError(it, status.error());
+ LOG(WARNING) << "Network error " << status.error();
+ DispatchResult(it, false);
return;
}
@@ -240,8 +240,7 @@ void PermissionRequestCreatorApiary::OnURLFetchComplete(
if (response_code != net::HTTP_OK) {
LOG(WARNING) << "HTTP error " << response_code;
- DispatchGoogleServiceAuthError(
- it, GoogleServiceAuthError(GoogleServiceAuthError::CONNECTION_FAILED));
+ DispatchResult(it, false);
return;
}
@@ -250,33 +249,27 @@ void PermissionRequestCreatorApiary::OnURLFetchComplete(
scoped_ptr<base::Value> value = base::JSONReader::Read(response_body);
base::DictionaryValue* dict = NULL;
if (!value || !value->GetAsDictionary(&dict)) {
- DispatchNetworkError(it, net::ERR_INVALID_RESPONSE);
+ LOG(WARNING) << "Invalid top-level dictionary";
+ DispatchResult(it, false);
return;
}
base::DictionaryValue* permission_dict = NULL;
if (!dict->GetDictionary(kPermissionRequestKey, &permission_dict)) {
- DispatchNetworkError(it, net::ERR_INVALID_RESPONSE);
+ LOG(WARNING) << "Permission request not found";
+ DispatchResult(it, false);
return;
}
std::string id;
if (!permission_dict->GetString(kIdKey, &id)) {
- DispatchNetworkError(it, net::ERR_INVALID_RESPONSE);
+ LOG(WARNING) << "ID not found";
+ DispatchResult(it, false);
return;
}
- (*it)->callback.Run(true);
- requests_.erase(it);
+ DispatchResult(it, true);
}
-void PermissionRequestCreatorApiary::DispatchNetworkError(RequestIterator it,
- int error_code) {
- DispatchGoogleServiceAuthError(
- it, GoogleServiceAuthError::FromConnectionError(error_code));
-}
-
-void PermissionRequestCreatorApiary::DispatchGoogleServiceAuthError(
- RequestIterator it,
- const GoogleServiceAuthError& error) {
- VLOG(1) << "GoogleServiceAuthError: " << error.ToString();
- (*it)->callback.Run(false);
+void PermissionRequestCreatorApiary::DispatchResult(RequestIterator it,
+ bool success) {
+ (*it)->callback.Run(success);
requests_.erase(it);
}
« no previous file with comments | « chrome/browser/supervised_user/child_accounts/permission_request_creator_apiary.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698