WorkflowExecutionException.h
1 
11 #ifndef WRENCH_EXCEPTION_H
12 #define WRENCH_EXCEPTION_H
13 
14 #include <exception>
15 #include <memory>
16 #include <string>
17 #include <string.h>
18 
19 #include "wrench/workflow/execution_events/FailureCause.h"
20 namespace wrench {
21 
22  /***********************/
24  /***********************/
25 
31  class WorkflowExecutionException: public std::exception {
32 
33  private:
34  std::shared_ptr<FailureCause> cause;
35 
36  public:
37 
42  virtual const char* what() const throw()
43  {
44  // Without the strdup() below, we get some valgrind warnings...
45  return strdup(cause->toString().c_str());
46  }
47 
52  std::shared_ptr<FailureCause> getCause() {
53  return this->cause;
54  }
55 
56 
57  /***********************/
59  /***********************/
60 
61 
62 //
63 // /**
64 // * @brief Constructor
65 // * @param cause: the cause of the failure
66 // */
67 // WorkflowExecutionException(FailureCause *cause) {
68 // this->cause = std::shared_ptr<FailureCause>(cause);
69 // }
70 
75  WorkflowExecutionException(std::shared_ptr<FailureCause> cause) {
76  this->cause = cause;
77  }
78 
79  /***********************/
81  /***********************/
82  };
83 
84 
85  /***********************/
87  /***********************/
88 
89 
90 }
91 
92 
93 #endif //WRENCH_EXCEPTION_H
std::shared_ptr< FailureCause > getCause()
Get the failure cause.
Definition: WorkflowExecutionException.h:52
virtual const char * what() const
Get the exception&#39;s error message.
Definition: WorkflowExecutionException.h:42
An generic exception that is thrown whenever something unexpected (but simulation-valid) occurrs duri...
Definition: WorkflowExecutionException.h:31
Definition: TerminalOutput.cpp:15