From 43691a72bb5a0f24183b2ebe418d27de7db79d39 Mon Sep 17 00:00:00 2001 From: Steven Murray <Steven.Murray@cern.ch> Date: Mon, 19 Feb 2018 11:14:30 +0100 Subject: [PATCH] Improved user error messages of RdbmsCatalogue::checkAndGetNextArchiveFileId() --- catalogue/RdbmsCatalogue.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/catalogue/RdbmsCatalogue.cpp b/catalogue/RdbmsCatalogue.cpp index 80ad7232fd..97bb396b9b 100644 --- a/catalogue/RdbmsCatalogue.cpp +++ b/catalogue/RdbmsCatalogue.cpp @@ -3917,7 +3917,7 @@ void RdbmsCatalogue::tapeLabelled(const std::string &vid, const std::string &dri // checkAndGetNextArchiveFileId //------------------------------------------------------------------------------ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskInstanceName, - const std::string &storageClassName, const common::dataStructures::UserIdentity &user){ + const std::string &storageClassName, const common::dataStructures::UserIdentity &user) { try { auto conn = m_connPool.getConn(); const common::dataStructures::TapeCopyToPoolMap copyToPoolMap = getTapeCopyToPoolMap(conn, diskInstanceName, @@ -3948,7 +3948,7 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns mountPolicy = mountPolicies.requesterGroupMountPolicies.front(); } else { exception::UserError ue; - ue.getMessage() << "Cannot archive file because there are no mount rules for the requester or their group:" + ue.getMessage() << "No mount rules for the requester or their group:" " storageClass=" << storageClassName << " requester=" << diskInstanceName << ":" << user.name << ":" << user.group; throw ue; @@ -3959,8 +3959,8 @@ uint64_t RdbmsCatalogue::checkAndGetNextArchiveFileId(const std::string &diskIns return getNextArchiveFileId(conn); } catch(exception::LostDatabaseConnection &le) { throw exception::LostDatabaseConnection(std::string(__FUNCTION__) + " failed: " + le.getMessage().str()); - } catch(exception::UserError &) { - throw; + } catch(exception::UserError &ue) { + throw exception::UserError(std::string("Cannot allocate a new archive file: ") + ue.getMessage().str()); } catch(exception::Exception &ex) { throw exception::Exception(std::string(__FUNCTION__) + " failed: " + ex.getMessage().str()); } -- GitLab