Salome HOME
Wrong case correction: start translation, select compsolid, activate value control...
[modules/shaper.git] / src / Events / Events_Error.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 /*
4  * Events_Error.cpp
5  *
6  *  Created on: Apr 28, 2014
7  *      Author: sbh
8  */
9
10 #include <Events_Error.h>
11 #include <Events_Loop.h>
12
13 #define THROW_EMPTY_AIS_EXCEPTION
14
15 Events_Error::Events_Error(const std::string& theDescription, const void* theSender)
16     : Events_Message(Events_Error::errorID(), theSender)
17 {
18   myDescription = theDescription;
19 }
20
21 Events_Error::~Events_Error()
22 {
23 }
24
25 Events_ID Events_Error::errorID()
26 {
27   Events_Loop* aLoop = Events_Loop::loop();
28   return aLoop->eventByName("ApplicationError");
29 }
30
31 const char* Events_Error::description() const
32 {
33   return myDescription.c_str();
34 }
35
36 void Events_Error::send(const std::string& theDescription, const void* theSender)
37 {
38   std::shared_ptr<Events_Message> aNewOne = 
39     std::shared_ptr<Events_Message>(new Events_Error(theDescription, theSender));
40   Events_Loop::loop()->send(aNewOne);
41 }
42
43 void Events_Error::throwException(const std::string& theDescription)
44 {
45 #ifdef THROW_EMPTY_AIS_EXCEPTION
46   Events_Error::send(
47       std::string("An exception: ") + theDescription);
48 #endif
49 }