Commit 5e39f376 authored by Steven Murray's avatar Steven Murray
Browse files

Renamed DatabaseConstraintViolation to DatabaseConstraintError

parent fc963e95
This diff is collapsed.
......@@ -16,13 +16,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <common/exception/DatabaseConstraintViolation.hpp>
#include "catalogue/ArchiveFileRow.hpp"
#include "catalogue/ChecksumTypeMismatch.hpp"
#include "catalogue/ChecksumValueMismatch.hpp"
#include "catalogue/FileSizeMismatch.hpp"
#include "catalogue/SqliteCatalogueSchema.hpp"
#include "catalogue/SqliteCatalogue.hpp"
#include "common/exception/DatabaseConstraintError.hpp"
#include "common/exception/Exception.hpp"
#include "common/exception/UserError.hpp"
#include "common/make_unique.hpp"
......@@ -447,7 +447,7 @@ void SqliteCatalogue::fileWrittenToTape(const rdbms::AutocommitMode autocommitMo
row.diskFileGroup = event.diskFileGroup;
row.diskFileRecoveryBlob = event.diskFileRecoveryBlob;
insertArchiveFile(conn, autocommitMode, row);
} catch(exception::DatabaseConstraintViolation &) {
} catch(exception::DatabaseConstraintError &) {
// Ignore this error
} catch(...) {
throw;
......
......@@ -79,7 +79,7 @@ set (COMMON_LIB_SRC_FILES
exception/Backtrace.cpp
exception/BadAlloc.cpp
exception/CommandLineNotParsed.cpp
exception/DatabaseConstraintViolation.cpp
exception/DatabaseConstraintError.cpp
exception/DismountFailed.cpp
exception/Errnum.cpp
exception/Exception.cpp
......
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/exception/DatabaseConstraintViolation.hpp"
#include "common/exception/DatabaseConstraintError.hpp"
namespace cta {
namespace exception {
......@@ -24,14 +24,14 @@ namespace exception {
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
DatabaseConstraintViolation::DatabaseConstraintViolation(const std::string &context, const bool embedBacktrace):
DatabaseConstraintError::DatabaseConstraintError(const std::string &context, const bool embedBacktrace):
Exception(context, embedBacktrace) {
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
DatabaseConstraintViolation::~DatabaseConstraintViolation() noexcept {
DatabaseConstraintError::~DatabaseConstraintError() noexcept {
}
} // namespace exception
......
......@@ -27,9 +27,9 @@ namespace cta {
namespace exception {
/**
* A database constraint has been violated.
* A database constraint error.
*/
class DatabaseConstraintViolation : public cta::exception::Exception {
class DatabaseConstraintError : public cta::exception::Exception {
public:
/**
......@@ -40,15 +40,15 @@ public:
* @param embedBacktrace whether to embed a backtrace of where the
* exception was throw in the message
*/
DatabaseConstraintViolation(const std::string &context = "", const bool embedBacktrace = true);
DatabaseConstraintError(const std::string &context = "", const bool embedBacktrace = true);
/**
* Empty Destructor, explicitely non-throwing (needed for std::exception
* inheritance)
*/
~DatabaseConstraintViolation() noexcept override;
~DatabaseConstraintError() noexcept override;
}; // class DatabaseConstraintViolation
}; // class DatabaseConstraintError
} // namespace exception
} // namespace cta
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/exception/DatabaseConstraintViolation.hpp"
#include "common/exception/DatabaseConstraintError.hpp"
#include "common/exception/Exception.hpp"
#include "common/exception/Errnum.hpp"
#include "rdbms/NullDbValue.hpp"
......@@ -156,7 +156,7 @@ bool SqliteRset::next() {
Sqlite::rcToStr(stepRc);
if(SQLITE_CONSTRAINT == stepRc) {
throw exception::DatabaseConstraintViolation(msg.str());
throw exception::DatabaseConstraintError(msg.str());
} else {
throw exception::Exception(msg.str());
}
......
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/exception/DatabaseConstraintViolation.hpp"
#include "common/exception/DatabaseConstraintError.hpp"
#include "common/exception/Exception.hpp"
#include "common/make_unique.hpp"
#include "common/threading/MutexLocker.hpp"
......@@ -267,7 +267,7 @@ void SqliteStmt::executeNonQuery() {
msg << __FUNCTION__ << " failed for SQL statement " << getSqlForException() + ": " << Sqlite::rcToStr(stepRc);
if(SQLITE_CONSTRAINT == stepRc) {
throw exception::DatabaseConstraintViolation(msg.str());
throw exception::DatabaseConstraintError(msg.str());
} else {
throw exception::Exception(msg.str());
}
......
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/exception/DatabaseConstraintViolation.hpp"
#include "common/exception/DatabaseConstraintError.hpp"
#include "rdbms/wrapper/SqliteConn.hpp"
#include "rdbms/wrapper/SqliteRset.hpp"
#include "rdbms/wrapper/SqliteStmt.hpp"
......@@ -401,7 +401,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeNonQuery_insert_violating_primar
":COL1);";
auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON);
stmt->bindUint64(":COL1", 1);
ASSERT_THROW(stmt->executeNonQuery(), exception::DatabaseConstraintViolation);
ASSERT_THROW(stmt->executeNonQuery(), exception::DatabaseConstraintError);
}
}
......@@ -448,7 +448,7 @@ TEST_F(cta_rdbms_wrapper_SqliteStmtTest, executeQuery_insert_violating_primary_k
auto stmt = conn.createStmt(sql, rdbms::AutocommitMode::ON);
stmt->bindUint64(":COL1", 1);
auto rset = stmt->executeQuery();
ASSERT_THROW(rset->next(), exception::DatabaseConstraintViolation);
ASSERT_THROW(rset->next(), exception::DatabaseConstraintError);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment