summaryrefslogtreecommitdiffstats
path: root/src/lib/database/db_exceptions.h
blob: 9656ab0331564890a8e5b82ffa7fa1346507d069 (plain)
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
// Copyright (C) 2015-2023 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef DB_EXCEPTIONS_H
#define DB_EXCEPTIONS_H

#include <exceptions/exceptions.h>

namespace isc {
namespace db {

/// @brief Multiple lease records found where one expected
class MultipleRecords : public Exception {
public:
    MultipleRecords(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Data is truncated
class DataTruncated : public Exception {
public:
    DataTruncated(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Database duplicate entry error
class DuplicateEntry : public Exception {
public:
    DuplicateEntry(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Key is NULL but was specified NOT NULL
class NullKeyError : public Exception {
public:
    NullKeyError(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Attempt to modify data in read-only database.
class ReadOnlyDb : public Exception {
public:
    ReadOnlyDb(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Upper bound address is lower than lower bound address while
/// retrieving a range of leases.
class InvalidRange : public Exception {
public:
    InvalidRange(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Invalid address family used as input to Lease Manager.
class InvalidAddressFamily : public Exception {
public:
    InvalidAddressFamily(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Error detected in the database configuration.
class DbConfigError : public Exception {
public:
    DbConfigError(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Error when specified database could not be found in the server
/// configuration.
class NoSuchDatabase :  public Exception {
public:
    NoSuchDatabase(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Specification of the database backend to be used yields
/// multiple results.
class AmbiguousDatabase :  public Exception {
public:
    AmbiguousDatabase(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

/// @brief Thrown when it is expected that some rows are affected,
/// usually during a DELETE or an UPDATE, but none are.
class NoRowsAffected : public Exception {
public:
    NoRowsAffected(const char* file, size_t line, const char* what) :
        isc::Exception(file, line, what) {}
};

}  // namespace isc
}  // namespace db

#endif