diff options
author | gene@google.com <gene@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 23:53:27 +0000 |
---|---|---|
committer | gene@google.com <gene@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 23:53:27 +0000 |
commit | cfde8643578c778c94cc56d3e3d97d477daa9ce5 (patch) | |
tree | 7196913d590920d1aac9fd962cbae27543ca8b36 /chrome/service | |
parent | 0675e71a3b61b8c4855d82d49e929b54b44c7eac (diff) | |
download | chromium_src-cfde8643578c778c94cc56d3e3d97d477daa9ce5.zip chromium_src-cfde8643578c778c94cc56d3e3d97d477daa9ce5.tar.gz chromium_src-cfde8643578c778c94cc56d3e3d97d477daa9ce5.tar.bz2 |
Added CUPS error handling.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/6250144
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/cloud_print/print_system_cups.cc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc index 0e40dff..6cb26e1 100644 --- a/chrome/service/cloud_print/print_system_cups.cc +++ b/chrome/service/cloud_print/print_system_cups.cc @@ -545,19 +545,21 @@ bool PrintSystemCUPS::GetJobDetails(const std::string& printer_name, cups_job_t* jobs = NULL; int num_jobs = GetJobs(&jobs, server_info->url, short_printer_name.c_str(), 1, -1); - + bool error = (num_jobs == 0) && (cupsLastError() > IPP_OK_EVENTS_COMPLETE); + if (error) { + VLOG(1) << "CP_CUPS: Error getting jobs from CUPS server. Printer:" + << printer_name + << " Error: " + << static_cast<int>(cupsLastError()); + return false; + } // Check if the request is for dummy dry run job. // We check this after calling GetJobs API to see if this printer is actually // accessible through CUPS. if (job_id == kDryRunJobId) { - if (num_jobs >= 0) { - job_details->status = PRINT_JOB_STATUS_COMPLETED; - VLOG(1) << "CP_CUPS: Dry run job succeeded for: " << printer_name; - } else { - job_details->status = PRINT_JOB_STATUS_ERROR; - VLOG(1) << "CP_CUPS: Dry run job faield for: " << printer_name; - } + job_details->status = PRINT_JOB_STATUS_COMPLETED; + VLOG(1) << "CP_CUPS: Dry run job succeeded for: " << printer_name; return true; } |