From e1cf1bf8d9b61fc6862774ad552a3500908a7ff2 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Thu, 16 Mar 2023 12:38:10 -0500 Subject: [PATCH] Added new cms::errors::ExternalFailure exception In order to allow a unique return code in the case of a failure in the SharedMemory package we added a new error code. --- FWCore/Integration/plugins/TestInterProcessProd.cc | 2 +- FWCore/Integration/plugins/TestInterProcessRandomProd.cc | 2 +- FWCore/SharedMemory/interface/ControllerChannel.h | 6 +++--- FWCore/SharedMemory/test/test_channels_startupTimeout.cc | 2 +- FWCore/Utilities/interface/EDMException.h | 1 + FWCore/Utilities/src/EDMException.cc | 1 + 6 files changed, 8 insertions(+), 6 deletions(-) diff --git a/FWCore/Integration/plugins/TestInterProcessProd.cc b/FWCore/Integration/plugins/TestInterProcessProd.cc index 634dd34e6f165..3c9b7fcde5b1f 100644 --- a/FWCore/Integration/plugins/TestInterProcessProd.cc +++ b/FWCore/Integration/plugins/TestInterProcessProd.cc @@ -63,7 +63,7 @@ namespace testinter { iTransitionID)) { std::cout << id_ << " FAILED waiting for external process" << std::endl; externalFailed_ = true; - throw cms::Exception("ExternalFailed"); + throw edm::Exception(edm::errors::ExternalFailure); } return value; } diff --git a/FWCore/Integration/plugins/TestInterProcessRandomProd.cc b/FWCore/Integration/plugins/TestInterProcessRandomProd.cc index e6b719a9316e3..3da47e4657753 100644 --- a/FWCore/Integration/plugins/TestInterProcessRandomProd.cc +++ b/FWCore/Integration/plugins/TestInterProcessRandomProd.cc @@ -75,7 +75,7 @@ namespace testinter { iTransitionID)) { std::cout << id_ << " FAILED waiting for external process" << std::endl; externalFailed_ = true; - throw cms::Exception("ExternalFailed"); + throw edm::Exception(edm::errors::ExternalFailure); } return value; } diff --git a/FWCore/SharedMemory/interface/ControllerChannel.h b/FWCore/SharedMemory/interface/ControllerChannel.h index 0cbf49e1d4f54..2ae8dc7162158 100644 --- a/FWCore/SharedMemory/interface/ControllerChannel.h +++ b/FWCore/SharedMemory/interface/ControllerChannel.h @@ -29,7 +29,7 @@ // user include files #include "FWCore/Utilities/interface/Transition.h" -#include "FWCore/Utilities/interface/Exception.h" +#include "FWCore/Utilities/interface/EDMException.h" #include "FWCore/SharedMemory/interface/BufferInfo.h" // forward declarations @@ -63,7 +63,7 @@ namespace edm::shared_memory { if (not wait(lock)) { //std::cout << id_ << " FAILED waiting for external process" << std::endl; *stop_ = true; - throw cms::Exception("ExternalFailed") + throw edm::Exception(edm::errors::ExternalFailure) << "Failed waiting for external process while setting up the process. Timed out after " << maxWaitInSeconds_ << " seconds."; } else { @@ -87,7 +87,7 @@ namespace edm::shared_memory { if (not wait(lock)) { if (not iRetry()) { *stop_ = true; - throw cms::Exception("ExternalFailed") + throw edm::Exception(edm::errors::ExternalFailure) << "Failed waiting for external process while setting up the process. Timed out after " << maxWaitInSeconds_ << " seconds with " << retryCount << " retries."; } diff --git a/FWCore/SharedMemory/test/test_channels_startupTimeout.cc b/FWCore/SharedMemory/test/test_channels_startupTimeout.cc index 0f76badc40ef2..9ad57598b3287 100644 --- a/FWCore/SharedMemory/test/test_channels_startupTimeout.cc +++ b/FWCore/SharedMemory/test/test_channels_startupTimeout.cc @@ -30,7 +30,7 @@ int main(int argc, char** argv) { retValue = controller(argc, argv, 5); } } catch (cms::Exception const& iException) { - if (iException.category() != "ExternalFailed") { + if (iException.category() != "ExternalFailure") { throw; } else { std::cout << "expected failure occurred\n"; diff --git a/FWCore/Utilities/interface/EDMException.h b/FWCore/Utilities/interface/EDMException.h index 8ff864a0301f5..1c87bc99e085d 100644 --- a/FWCore/Utilities/interface/EDMException.h +++ b/FWCore/Utilities/interface/EDMException.h @@ -68,6 +68,7 @@ namespace edm { FileNameInconsistentWithGUID = 8034, UnavailableAccelerator = 8035, + ExternalFailure = 8036, EventGenerationFailure = 8501, diff --git a/FWCore/Utilities/src/EDMException.cc b/FWCore/Utilities/src/EDMException.cc index c3d5530b47a1f..077b849d8c8b4 100644 --- a/FWCore/Utilities/src/EDMException.cc +++ b/FWCore/Utilities/src/EDMException.cc @@ -44,6 +44,7 @@ namespace edm { FILLENTRY(FileWriteError), FILLENTRY(FileNameInconsistentWithGUID), FILLENTRY(UnavailableAccelerator), + FILLENTRY(ExternalFailure), FILLENTRY(EventGenerationFailure), FILLENTRY(CaughtSignal)}; static const std::string kUnknownCode("unknownCode");