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,2019,2020 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, \@_;
40 push @{$subclasses{$_[1]}}, $_[0];
45 my ($class, $parent) = @_;
47 push @{$subclasses{$parent}}, $class;
48 $classcode{$class} = $typecode;
51 errorbaseclass('LogicError', 'Error',
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.
58 # RuntimeError and subclasses:
60 errorbaseclass
('RuntimeError', 'Error',
61 'The base class for exceptions indicating errors only detectable at runtime.',
63 A subclass of RuntimeError will be thrown if Xapian detects an error
64 which is exception derived from RuntimeError is thrown when an
65 error is caused by problems with the data or environment rather
66 than a programming mistake.
69 errorclass
(0, 'FileNotFoundError', 'RuntimeError',
70 'FileNotFoundError indicates that the file was not found at the path supplied.',
73 errorclass
(1, 'LetorParseError', 'RuntimeError',
74 'LetorParseError indicates file parsing error.',
76 You should check that the file being parsed follows the standard set by
80 errorclass
(2, 'LetorInternalError', 'RuntimeError',
81 'LetorInternalError indicates a runtime problem of some sort.',
84 sub for_each_nothrow
{
86 foreach my $header ('include/xapian-letor.h', <include
/xapian
-letor
/*.h
>) {
88 open H
, '<', $header or die $!;
89 my $header_text = <H
>;
91 $header_text =~ s!/(?:/[^\n]*|\*.*?\*/)! !gs;
92 # Ignore the parts SWIG is told to ignore.
93 $header_text =~ s/^\s*#\s*if(?:ndef|\s+!\s*defined)\s+SWIG\b.*?^\s*#\s*endif\b.*?$//gsm;
95 for (split /[;}{]\n/, $header_text) {
97 if (/^\s*(?:class|struct)\s+XAPIAN_VISIBILITY_DEFAULT\s+(\w+)/) {
99 &$func("Xapian::$class~$1");
103 /\b((?:operator *\S+|[A-Za-z][A-Za-z0-9_]+)\(.*\))((?: \w+)*)/ or next;
106 if ($attributes !~ /\bnoexcept\b/) {
109 if ($attributes =~ /\bconst\b/) {
112 &$func("Xapian::$class$method");