This file is indexed.

/usr/share/doc/libyazpp-doc/zoom-exception.html is in libyazpp-doc 1.6.5-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>6. ZOOM::exception and subclasses</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="YAZ++ User's Guide and Reference"><link rel="up" href="zoom.html" title="Chapter 3. ZOOM-C++"><link rel="prev" href="zoom-record.html" title="5. ZOOM::record"><link rel="next" href="api.html" title="Chapter 4. YAZ C++ API"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">6. <code class="literal">ZOOM::exception</code> and subclasses</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="zoom-record.html">Prev</a> </td><th width="60%" align="center">Chapter 3. ZOOM-C++</th><td width="20%" align="right"> <a accesskey="n" href="api.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="zoom-exception"></a>6. <code class="literal">ZOOM::exception</code> and subclasses</h2></div></div></div><p>
    The <code class="literal">ZOOM::exception</code> class is a virtual base
    class, representing a diagnostic generated by the ZOOM-C++ library
    or returned from a server.  Its subclasses represent particular
    kinds of error.
   </p><p>
    When any of the ZOOM methods fail, they respond by
    <code class="literal">throw</code>ing an object of type
    <code class="literal">exception</code> or one of its subclasses.  This most
    usually happens with the <code class="literal">connection</code> constructor,
    the various query constructors, the <code class="literal">resultSet</code>
    constructor (which is actually the searching method), and
    <code class="literal">resultSet::getRecord()</code>.
   </p><p>
    The base class has this declaration:
   </p><pre class="synopsis">
    class exception {
    public:
      exception (int code);
      int errcode () const;
      const char *errmsg () const;
    };
   </pre><p>
    It has three concrete subclasses:
   </p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="zoom-systemException"></a>6.1. <code class="literal">ZOOM::systemException</code></h3></div></div></div><pre class="synopsis">
     class systemException: public exception {
     public:
       systemException ();
       int errcode () const;
       const char *errmsg () const;
     };
    </pre><p>
     Represents a ``system error'', typically indicating that a system
     call failed - often in the low-level networking code that
     underlies Z39.50.  <code class="literal">errcode()</code> returns the value
     that the system variable <code class="literal">errno</code> had at the time
     the exception was constructed; and <code class="literal">errmsg()</code>
     returns a human-readable error-message corresponding to that error
     code.
    </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="zoom-bib1Exception"></a>6.2. <code class="literal">ZOOM::bib1Exception</code></h3></div></div></div><pre class="synopsis">
     class bib1Exception: public exception {
     public:
       bib1Exception (int errcode, const char *addinfo);
       int errcode () const;
       const char *errmsg () const;
       const char *addinfo () const;
     };
    </pre><p>
     Represents an error condition communicated by a Z39.50 server.
     <code class="literal">errcode()</code> returns the BIB-1 diagnostic code of
     the error, and <code class="literal">errmsg()</code> a human-readable error
     message corresponding to that code.  <code class="literal">addinfo()</code>
     returns any additional information associated with the error.
    </p><p>
     For example, if a ZOOM application tries to search in the
     ``Voyager'' database of a server that does not have a database of
     that name, a <code class="literal">bib1Exception</code> will be thrown in
     which <code class="literal">errcode()</code> returns 109,
     <code class="literal">errmsg()</code> returns the corresponding error
     message ``Database unavailable'' and <code class="literal">addinfo()</code>
     returns the name of the requested, but unavailable, database.
    </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="zoom-queryException"></a>6.3. <code class="literal">ZOOM::queryException</code></h3></div></div></div><pre class="synopsis">
     class queryException: public exception {
     public:
       static const int PREFIX = 1;
       static const int CCL = 2;
       queryException (int qtype, const char *source);
       int errcode () const;
       const char *errmsg () const;
       const char *addinfo () const;
     };
    </pre><p>
     This class represents an error in parsing a query into a form that
     Z39.50 can understand.  It must be created with the
     <code class="literal">qtype</code> parameter equal to one of the query-type
     constants, which can be retrieved via the
     <code class="literal">errcode()</code> method; <code class="literal">errmsg()</code>
     returns an error-message specifying which kind of query was
     malformed; and <code class="literal">addinfo()</code> returns a copy of the
     query itself (that is, the value of <code class="literal">source</code> with
     which the exception object was created.)
    </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="revised-sample"></a>6.4. Revised Sample Program</h3></div></div></div><p>
     Now we can revise the sample program from the
     <a class="link" href="zoom.html#zoom-introduction" title="1. Introduction">introduction</a>
     to catch exceptions and report any errors:
    </p><pre class="programlisting">
    /* g++ -o zoom-c++-hw zoom-c++-hw.cpp -lzoompp -lyaz */

    #include &lt;iostream&gt;
    #include &lt;yazpp/zoom.h&gt;

    using namespace ZOOM;

    int main(int argc, char **argv)
    {
        try {
            connection conn("lx2.loc.gov", 210);
            conn.option("databaseName", "LCDB");
            conn.option("preferredRecordSyntax", "USMARC");
            resultSet rs(conn, prefixQuery("@attr 1=7 0253333490"));
            const record *rec = rs.getRecord(0);
            cout &lt;&lt; rec-&gt;render() &lt;&lt; endl;
        } catch (systemException &amp;e) {
            cerr &lt;&lt; "System error " &lt;&lt;
                e.errcode() &lt;&lt; " (" &lt;&lt; e.errmsg() &lt;&lt; ")" &lt;&lt; endl;
        } catch (bib1Exception &amp;e) {
            cerr &lt;&lt; "BIB-1 error " &lt;&lt; 
                e.errcode() &lt;&lt; " (" &lt;&lt; e.errmsg() &lt;&lt; "): " &lt;&lt; e.addinfo() &lt;&lt; endl;
        } catch (queryException &amp;e) {
            cerr &lt;&lt; "Query error " &lt;&lt;
                e.errcode() &lt;&lt; " (" &lt;&lt; e.errmsg() &lt;&lt; "): " &lt;&lt; e.addinfo() &lt;&lt; endl;
        } catch (exception &amp;e) {
            cerr &lt;&lt; "Error " &lt;&lt;
                e.errcode() &lt;&lt; " (" &lt;&lt; e.errmsg() &lt;&lt; ")" &lt;&lt; endl;
        }
    }
    </pre><p>
     The heart of this program is the same as in the original version,
     but it's now wrapped in a <code class="literal">try</code> block followed by
     several <code class="literal">catch</code> blocks which try to give helpful
     diagnostics if something goes wrong.
    </p><p>
     The first such block diagnoses system-level errors such as memory
     exhaustion or a network connection being broken by a server's
     untimely death; the second catches errors at the Z39.50 level,
     such as a server's report that it can't provide records in USMARC
     syntax; the third is there in case there's something wrong with
     the syntax of the query (although in this case it's correct); and
     finally, the last <code class="literal">catch</code> block is a
     belt-and-braces measure to be sure that nothing escapes us.
    </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="exception.references"></a>6.5. References</h3></div></div></div><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
       <a class="ulink" href="http://zoom.z3950.org/api/zoom-current.html#3.7" target="_top">Section 3.7 (Exception) of the ZOOM Abstract API</a>
      </p></li><li class="listitem"><p>
       <a class="ulink" href="http://www.loc.gov/z3950/agency/defns/bib1diag.html" target="_top">Bib-1 Diagnostics</a> on the
       <a class="ulink" href="http://www.loc.gov/z3950/agency/" target="_top">Z39.50 Maintenance Agency</a> site.
      </p></li></ul></div><p>
     Because C does not support exceptions, ZOOM-C has no API element
     that corresponds directly with ZOOM-C++'s
     <code class="literal">exception</code> class and its subclasses.  The
     closest thing is the <code class="literal">ZOOM_connection_error</code>
     function described in the
     <a class="ulink" href="http://www.indexdata.com/yaz/doc/zoom.html#zoom.connections" target="_top">Connections section</a> of the documentation.
    </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="zoom-record.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="zoom.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="api.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">5. <code class="literal">ZOOM::record</code> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 4. YAZ C++ API</td></tr></table></div></body></html>