From cd0a39cafbbe37449c3f8efc78385345803d15e2 Mon Sep 17 00:00:00 2001 From: Cedric CAFFY <cedric.caffy@cern.ch> Date: Fri, 17 May 2019 14:42:54 +0200 Subject: [PATCH] Changed the exception thrown by rootEntry.getRepackIndexAddress() from cta::RootEntry::NotAllocated to cta::exception::Exception to spot if the backtrace comes from the macro generating the exceptions --- objectstore/Helpers.cpp | 4 ++-- objectstore/RootEntry.cpp | 4 ++-- scheduler/OStoreDB/OStoreDB.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/objectstore/Helpers.cpp b/objectstore/Helpers.cpp index f0b770566c..6eff98a143 100644 --- a/objectstore/Helpers.cpp +++ b/objectstore/Helpers.cpp @@ -669,7 +669,7 @@ void Helpers::registerRepackRequestToIndex(const std::string& vid, const std::st // First, try to get the address of of the repack index lockfree. try { repackIndexAddress = re.getRepackIndexAddress(); - } catch (RootEntry::NotAllocated &){ + } catch (cta::exception::Exception &){ ScopedExclusiveLock rel(re); re.fetch(); repackIndexAddress = re.addOrGetRepackIndexAndCommit(agentReference); @@ -692,7 +692,7 @@ void Helpers::removeRepackRequestToIndex(const std::string& vid, Backend& backen // First, try to get the address of of the repack index lockfree. try { repackIndexAddress = re.getRepackIndexAddress(); - } catch (RootEntry::NotAllocated &){ + } catch (cta::exception::Exception &){ // No repack index, nothing to do. return; } diff --git a/objectstore/RootEntry.cpp b/objectstore/RootEntry.cpp index 6f67ce5839..91869db204 100644 --- a/objectstore/RootEntry.cpp +++ b/objectstore/RootEntry.cpp @@ -740,7 +740,7 @@ std::string RootEntry::getRepackIndexAddress() { m_payload.repackindexpointer().address().size()) { return m_payload.repackindexpointer().address(); } - throw NotAllocated("In RootEntry::getRepackIndexAddress: repack tape register not yet allocated"); + throw cta::exception::Exception("In RootEntry::getRepackIndexAddress: repack tape register not yet allocated"); } std::string RootEntry::addOrGetRepackIndexAndCommit(AgentReference& agentRef) { @@ -748,7 +748,7 @@ std::string RootEntry::addOrGetRepackIndexAndCommit(AgentReference& agentRef) { // Check if the repack tape register exists try { return getRepackIndexAddress(); - } catch (NotAllocated &) { + } catch (cta::exception::Exception &) { // TODO: this insertion method is much simpler than the ones used for other objects. // It implies the only dangling pointer situation we can get is the one where // the object does not exist. diff --git a/scheduler/OStoreDB/OStoreDB.cpp b/scheduler/OStoreDB/OStoreDB.cpp index f61b74c340..5b40e5d0d2 100644 --- a/scheduler/OStoreDB/OStoreDB.cpp +++ b/scheduler/OStoreDB/OStoreDB.cpp @@ -1377,7 +1377,7 @@ std::list<common::dataStructures::RepackInfo> OStoreDB::getRepackInfo() { // First, try to get the address of of the repack index lockfree. try { ri.setAddress(re.getRepackIndexAddress()); - } catch (RootEntry::NotAllocated &) { + } catch (cta::exception::Exception &) { return ret; } ri.fetchNoLock(); @@ -1402,7 +1402,7 @@ common::dataStructures::RepackInfo OStoreDB::getRepackInfo(const std::string& vi // First, try to get the address of of the repack index lockfree. try { ri.setAddress(re.getRepackIndexAddress()); - } catch (RootEntry::NotAllocated &) { + } catch (cta::exception::Exception &) { throw NoSuchRepackRequest("In OStoreDB::getRepackInfo(): No repack request for this VID (index not present)."); } ri.fetchNoLock(); @@ -1479,7 +1479,7 @@ void OStoreDB::populateRepackRequestsStatistics(RootEntry & re, SchedulerDatabas objectstore::RepackIndex ri(m_objectStore); try { ri.setAddress(re.getRepackIndexAddress()); - } catch (RootEntry::NotAllocated &) { + } catch (cta::exception::Exception &) { return; } ri.fetchNoLock(); @@ -2345,7 +2345,7 @@ void OStoreDB::cancelRepack(const std::string& vid, log::LogContext & lc) { // First, try to get the address of of the repack index lockfree. try { ri.setAddress(re.getRepackIndexAddress()); - } catch (RootEntry::NotAllocated &) { + } catch (cta::exception::Exception &) { throw NoSuchRepackRequest("In OStoreDB::cancelRepack(): No repack request for this VID (index not present)."); } ri.fetchNoLock(); -- GitLab