+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
/*
* Events_Error.cpp
*
#include <Events_Error.h>
#include <Events_Loop.h>
-Events_Error::Events_Error(char* theDescription, const void* theSender)
+#define THROW_EMPTY_AIS_EXCEPTION
+
+Events_Error::Events_Error(const std::string& theDescription, const void* theSender)
: Events_Message(Events_Error::errorID(), theSender)
{
myDescription = theDescription;
return aLoop->eventByName("ApplicationError");
}
-char* Events_Error::description() const
+const char* Events_Error::description() const
{
- return myDescription;
+ return myDescription.c_str();
}
-void Events_Error::send(char* theDescription, const void* theSender)
+void Events_Error::send(const std::string& theDescription, const void* theSender)
{
- boost::shared_ptr<Events_Message> aNewOne =
- boost::shared_ptr<Events_Message>(new Events_Error(theDescription, theSender));
+ std::shared_ptr<Events_Message> aNewOne =
+ std::shared_ptr<Events_Message>(new Events_Error(theDescription, theSender));
Events_Loop::loop()->send(aNewOne);
}
-void Events_Error::send(std::string theDescription, const void* theSender)
+void Events_Error::throwException(const std::string& theDescription)
{
- Events_Error::send((char*) theDescription.c_str(), theSender);
-}
+#ifdef THROW_EMPTY_AIS_EXCEPTION
+ try {
+ throw;
+ }
+ catch (...) {
+ Events_Error::send(
+ std::string("An exception: ") + theDescription);
+ }
+#endif
+}
\ No newline at end of file