title: How to get reason CUPS job was stopped?
body: <p><strong>How do I get the reason a CUPS print job failed, via the CUPS API?</strong></p>
  
  <p>Using the CUPS API, I printed two jobs that failed to print. On the CUPS web interface, I can see why they failed: "Unsupported print data." and "Unable to write print data."</p>
  
  <p><img src="https://i.stack.imgur.com/69SHM.png" alt="CUPS print job error description"></p>
  
  <p>However, the API doesn't seem to contain these reasons. The <a href="http://www.cups.org/documentation.php/doc-1.7/api-cups.html#cupsGetJobs" rel="noreferrer"><code>cupsGetJobs()</code></a> method returns <a href="http://www.cups.org/documentation.php/doc-1.7/api-cups.html#cups_job_s" rel="noreferrer"><code>cups_job_s</code></a> structs, which look like this:</p>
  
  <pre><code>struct cups_job_s {
      time_t completed_time;
      time_t creation_time;
      char *dest;
      char *format;
      int id;
      int priority;
      time_t processing_time;
      int size;
      ipp_jstate_t state;
      char *title;
      char *user;
  };
  </code></pre>
  
  <p>I have inspected all of these fields, none of them contain the error strings seen in the screenshot.</p>