Line data Source code
1 : // Copyright (c) 2019 Made to Order Software Corp. All Rights Reserved
2 : //
3 : // https://snapwebsites.org/project/snapdatabase
4 : // contact@m2osw.com
5 : //
6 : // This program is free software; you can redistribute it and/or modify
7 : // it under the terms of the GNU General Public License as published by
8 : // the Free Software Foundation; either version 2 of the License, or
9 : // (at your option) any later version.
10 : //
11 : // This program is distributed in the hope that it will be useful,
12 : // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 : // GNU General Public License for more details.
15 : //
16 : // You should have received a copy of the GNU General Public License along
17 : // with this program; if not, write to the Free Software Foundation, Inc.,
18 : // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 : #pragma once
20 :
21 : /** \file
22 : * \brief Snap! Database exceptions.
23 : *
24 : * This files declares a few exceptions that the database uses when a
25 : * parameter is wrong or something goes wrong (can't open a file, can't
26 : * create a lock for the context, etc.)
27 : *
28 : * The snapdatabase also makes use of the snaplogger so it will emit
29 : * a corresponding error to the log before throwing an exception.
30 : */
31 :
32 :
33 : // libexcept lib
34 : //
35 : #include <libexcept/exception.h>
36 :
37 :
38 : namespace snapdatabase
39 : {
40 :
41 :
42 :
43 0 : DECLARE_LOGIC_ERROR(snapdatabase_logic_error);
44 :
45 0 : DECLARE_OUT_OF_RANGE(snapdatabase_out_of_range);
46 :
47 : DECLARE_MAIN_EXCEPTION(fatal_error);
48 204 : DECLARE_MAIN_EXCEPTION(snapdatabase_error);
49 :
50 : // uncomment as we use these
51 0 : DECLARE_EXCEPTION(snapdatabase_error, column_not_found);
52 0 : DECLARE_EXCEPTION(snapdatabase_error, field_not_found);
53 0 : DECLARE_EXCEPTION(snapdatabase_error, file_not_found);
54 0 : DECLARE_EXCEPTION(snapdatabase_error, file_not_opened);
55 0 : DECLARE_EXCEPTION(snapdatabase_error, id_already_assigned);
56 0 : DECLARE_EXCEPTION(snapdatabase_error, id_missing);
57 0 : DECLARE_EXCEPTION(snapdatabase_error, invalid_entity);
58 0 : DECLARE_EXCEPTION(snapdatabase_error, invalid_number);
59 200 : DECLARE_EXCEPTION(snapdatabase_error, invalid_parameter);
60 0 : DECLARE_EXCEPTION(snapdatabase_error, invalid_size);
61 0 : DECLARE_EXCEPTION(snapdatabase_error, invalid_token);
62 0 : DECLARE_EXCEPTION(snapdatabase_error, invalid_xml);
63 0 : DECLARE_EXCEPTION(snapdatabase_error, io_error);
64 0 : DECLARE_EXCEPTION(snapdatabase_error, node_already_in_tree);
65 0 : DECLARE_EXCEPTION(snapdatabase_error, page_not_found);
66 0 : DECLARE_EXCEPTION(snapdatabase_error, string_not_terminated);
67 0 : DECLARE_EXCEPTION(snapdatabase_error, type_mismatch);
68 0 : DECLARE_EXCEPTION(snapdatabase_error, unexpected_eof);
69 4 : DECLARE_EXCEPTION(snapdatabase_error, unexpected_token);
70 0 : DECLARE_EXCEPTION(snapdatabase_error, out_of_bounds);
71 :
72 :
73 :
74 : } // namespace snaplogger
75 : // vim: ts=4 sw=4 et
|