From: mike Date: Fri, 1 Dec 2006 14:11:21 +0000 (+0000) Subject: Document $record->error()/exception() X-Git-Tag: cpan_1_22~92 X-Git-Url: http://git.indexdata.com/?p=ZOOM-Perl-moved-to-github.git;a=commitdiff_plain;h=00c00e99543145f444acb9802dc92802e355c78b Document $record->error()/exception() --- diff --git a/lib/ZOOM.pod b/lib/ZOOM.pod index 1b62c13..e3c6416 100644 --- a/lib/ZOOM.pod +++ b/lib/ZOOM.pod @@ -1,4 +1,4 @@ -# $Id: ZOOM.pod,v 1.40 2006-11-03 09:49:38 mike Exp $ +# $Id: ZOOM.pod,v 1.41 2006-12-01 14:11:21 mike Exp $ use strict; use warnings; @@ -636,6 +636,34 @@ http://zoom.z3950.org/api/zoom-current.html#3.5 =head3 Methods +=head4 error() / exception() + + if ($rec->error()) { + my($code, $msg, $addinfo, $dset) = $rec->error(); + print "error $code, $msg ($addinfo) from $dset set\n"; + die $rec->exception(); + } + +These functions test for surrogate diagnostics associated with a +record: that is, errors pertaining to a particular record rather than +to the fetch-some-records operation as a whole. (The latter are known +in Z39.50 as non-surrogate diagnostics, and are reported as exceptions +thrown by searches.) If a particular record can't be obtained - for +example, because it is not available in the requested record syntax - +then the record object obtained from the result-set, when interrogated +with these functions, will report the error. + +C returns the error-code, a human-readable message, +additional information and the name of the diagnostic set that the +error is from. When called in a scalar context, it just returns the +error-code. Since error 0 means "no error", it can be used as a +boolean has-there-been-an-error indicator. + +C returns the same information in the form of a +C object which may be thrown or rendered. If no +error occurred on the record, then C returns an undefined +value. + =head4 render() print $rec->render(); @@ -1275,7 +1303,7 @@ C, C, C, C, -C, +C, C, C, C,