00001 #include "FWCore/Utilities/interface/ConvertException.h" 00002 #include "FWCore/Utilities/interface/EDMException.h" 00003 00004 #include <iostream> 00005 00006 namespace edm { 00007 00008 void convertException::badAllocToEDM() { 00009 std::cerr << "\nstd::bad_alloc exception" << std::endl; 00010 edm::Exception e(edm::errors::BadAlloc); 00011 e << "A std::bad_alloc exception was thrown.\n" 00012 << "The job has probably exhausted the virtual memory available to the process.\n"; 00013 throw e; 00014 } 00015 00016 void convertException::stdToEDM(std::exception const& e) { 00017 edm::Exception ex(edm::errors::StdException); 00018 ex << "A std::exception was thrown.\n" 00019 << e.what(); 00020 throw ex; 00021 } 00022 00023 void convertException::stringToEDM(std::string& s) { 00024 edm::Exception e(edm::errors::BadExceptionType); 00025 e << "A std::string was thrown as an exception.\n" 00026 << s; 00027 throw e; 00028 } 00029 00030 void convertException::charPtrToEDM(char const* c) { 00031 edm::Exception e(edm::errors::BadExceptionType); 00032 e << "A const char* was thrown as an exception.\n" 00033 << c; 00034 throw e; 00035 } 00036 00037 void convertException::unknownToEDM() { 00038 edm::Exception e(edm::errors::Unknown); 00039 e << "An exception of unknown type was thrown.\n"; 00040 throw e; 00041 } 00042 }