1 # exception_data.pm: details of the exception hierarchy used by Xapian.
2 package exception_data
;
4 /* Copyright (C) 2003,2004,2006,2007,2008,2009,2011,2015 Olly Betts
5 * Copyright (C) 2007 Richard Boulton
6 * Copyright (C) 2016 Ayush Tomar
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 $copyright $generated_warning @baseclasses @classes %subclasses %classcode
31 "/* Warning: This file is generated by $0 - do not modify directly! */\n";
39 push @baseclasses, join("\t", @_);
40 push @{$subclasses{$_[1]}}, $_[0];
45 my ($class, $parent) = @_;
46 push @classes, join("\t", @_);
47 push @{$subclasses{$parent}}, $class;
48 $classcode{$class} = $typecode;
51 errorbaseclass('LogicError', 'Error', <<'DOC');
52 /** The base class for exceptions indicating errors in the program logic.
54 * A subclass of LogicError will be thrown if Xapian detects a violation
55 * of a class invariant or a logical precondition or postcondition, etc.
59 # RuntimeError and subclasses:
61 errorbaseclass
('RuntimeError', 'Error', <<'DOC');
62 /** The base class for exceptions indicating errors only detectable at runtime.
64 * A subclass of RuntimeError will be thrown if Xapian detects an error
65 * which is exception derived from RuntimeError is thrown when an
66 * error is caused by problems with the data or environment rather
67 * than a programming mistake.
71 errorclass
(0, 'FileNotFoundError', 'RuntimeError', <<'DOC');
72 /** FileNotFoundError indicates that the file was not found at the path supplied. */
75 errorclass
(1, 'LetorParseError', 'RuntimeError', <<'DOC');
76 /** LetorParseError indicates file parsing error. You should check that the file
77 * being parsed follows the standard set by xapian-letor.
81 errorclass
(2, 'LetorInternalError', 'RuntimeError', <<'DOC');
82 /** LetorInternalError indicates a runtime problem of some sort. */
85 sub for_each_nothrow
{
88 foreach my $header ('include/xapian-letor.h', <include
/xapian
-letor
/*.h
>) {
90 open H
, '<', $header or die $!;
91 my $header_text = <H
>;
92 # Strip comments, which might contain text describing XAPIAN_NOTHROW().
93 $header_text =~ s!/(?:/[^\n]*|\*.*?\*/)! !gs;
94 for (split /\n/, $header_text) {
95 if (/^\s*class\s+XAPIAN_VISIBILITY_DEFAULT\s+(\w+)/) {
99 if (/^[^#]*\bXAPIAN_NOTHROW\((.*)\)/) {
100 &$func("Xapian::$class$1");