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

Side by Side Diff: chrome/browser/policy/device_management_service.cc

Issue 10920088: Always log the exact error code from the dmserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/policy/device_management_service.h" 5 #include "chrome/browser/policy/device_management_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 int response_code, 313 int response_code,
314 const net::ResponseCookies& cookies, 314 const net::ResponseCookies& cookies,
315 const std::string& data) { 315 const std::string& data) {
316 if (status.status() != net::URLRequestStatus::SUCCESS) { 316 if (status.status() != net::URLRequestStatus::SUCCESS) {
317 LOG(WARNING) << "DMServer request failed, status: " << status.status() 317 LOG(WARNING) << "DMServer request failed, status: " << status.status()
318 << ", error: " << status.error(); 318 << ", error: " << status.error();
319 ReportError(DM_STATUS_REQUEST_FAILED); 319 ReportError(DM_STATUS_REQUEST_FAILED);
320 return; 320 return;
321 } 321 }
322 322
323 if (response_code != kSuccess)
324 LOG(WARNING) << "DMServer sent an error response: " << response_code;
325
323 switch (response_code) { 326 switch (response_code) {
324 case kSuccess: { 327 case kSuccess: {
325 em::DeviceManagementResponse response; 328 em::DeviceManagementResponse response;
326 if (!response.ParseFromString(data)) { 329 if (!response.ParseFromString(data)) {
327 ReportError(DM_STATUS_RESPONSE_DECODING_ERROR); 330 ReportError(DM_STATUS_RESPONSE_DECODING_ERROR);
328 return; 331 return;
329 } 332 }
330 callback_.Run(DM_STATUS_SUCCESS, response); 333 callback_.Run(DM_STATUS_SUCCESS, response);
331 return; 334 return;
332 } 335 }
(...skipping 23 matching lines...) Expand all
356 case kPolicyNotFound: 359 case kPolicyNotFound:
357 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND); 360 ReportError(DM_STATUS_SERVICE_POLICY_NOT_FOUND);
358 return; 361 return;
359 case kInvalidSerialNumber: 362 case kInvalidSerialNumber:
360 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER); 363 ReportError(DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER);
361 return; 364 return;
362 case kDeviceIdConflict: 365 case kDeviceIdConflict:
363 ReportError(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT); 366 ReportError(DM_STATUS_SERVICE_DEVICE_ID_CONFLICT);
364 return; 367 return;
365 default: 368 default:
366 VLOG(1) << "Unexpected HTTP status in response from DMServer : "
367 << response_code << ".";
368 // Handle all unknown 5xx HTTP error codes as temporary and any other 369 // Handle all unknown 5xx HTTP error codes as temporary and any other
369 // unknown error as one that needs more time to recover. 370 // unknown error as one that needs more time to recover.
370 if (response_code >= 500 && response_code <= 599) 371 if (response_code >= 500 && response_code <= 599)
371 ReportError(DM_STATUS_TEMPORARY_UNAVAILABLE); 372 ReportError(DM_STATUS_TEMPORARY_UNAVAILABLE);
372 else 373 else
373 ReportError(DM_STATUS_HTTP_STATUS_ERROR); 374 ReportError(DM_STATUS_HTTP_STATUS_ERROR);
374 return; 375 return;
375 } 376 }
376 } 377 }
377 378
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 } 585 }
585 } 586 }
586 587
587 const JobQueue::iterator elem = 588 const JobQueue::iterator elem =
588 std::find(queued_jobs_.begin(), queued_jobs_.end(), job); 589 std::find(queued_jobs_.begin(), queued_jobs_.end(), job);
589 if (elem != queued_jobs_.end()) 590 if (elem != queued_jobs_.end())
590 queued_jobs_.erase(elem); 591 queued_jobs_.erase(elem);
591 } 592 }
592 593
593 } // namespace policy 594 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698