2018-06-25 21:47:20 +02:00
|
|
|
// Copyright (C) 2015-2018 Internet Systems Consortium, Inc. ("ISC")
|
2015-11-30 21:26:25 +01:00
|
|
|
//
|
2015-12-15 21:37:34 +01:00
|
|
|
// 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/.
|
2015-11-30 21:26:25 +01:00
|
|
|
|
|
|
|
#ifndef DB_EXCEPTIONS_H
|
|
|
|
#define DB_EXCEPTIONS_H
|
|
|
|
|
|
|
|
#include <exceptions/exceptions.h>
|
|
|
|
|
|
|
|
namespace isc {
|
2018-08-28 11:56:19 +02:00
|
|
|
namespace db {
|
2015-11-30 21:26:25 +01:00
|
|
|
|
2017-08-18 16:47:58 +03:00
|
|
|
/// @brief Database statement not applied
|
2017-12-22 15:11:23 +01:00
|
|
|
///
|
|
|
|
/// Cassandra have a concept of mutation (any statement that does change the
|
2017-12-31 10:40:09 +01:00
|
|
|
/// data, like INSERT, UPDATE or DELETE). Under certain conditions it may be
|
2017-12-22 15:11:23 +01:00
|
|
|
/// possible that those statesments may fail to apply.
|
2017-08-18 16:47:58 +03:00
|
|
|
class StatementNotApplied : public Exception {
|
|
|
|
public:
|
|
|
|
StatementNotApplied(const char* file, size_t line, const char* what)
|
|
|
|
: isc::Exception(file, line, what) {
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-11-30 21:26:25 +01:00
|
|
|
/// @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 Attempt to update lease that was not there
|
|
|
|
class NoSuchLease : public Exception {
|
|
|
|
public:
|
|
|
|
NoSuchLease(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) {}
|
|
|
|
};
|
|
|
|
|
2016-07-12 09:43:30 +02:00
|
|
|
/// @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) {}
|
|
|
|
};
|
|
|
|
|
2018-06-25 21:47:20 +02:00
|
|
|
/// @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) {}
|
|
|
|
};
|
|
|
|
|
2018-06-26 14:49:36 +02:00
|
|
|
/// @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) {}
|
|
|
|
};
|
|
|
|
|
2017-08-18 16:47:58 +03:00
|
|
|
} // namespace isc
|
2018-08-28 11:56:19 +02:00
|
|
|
} // namespace db
|
2015-11-30 21:26:25 +01:00
|
|
|
|
|
|
|
#endif
|