aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SignalCatch.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/facade/SignalCatch.cpp')
-rw-r--r--src/crepe/facade/SignalCatch.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/crepe/facade/SignalCatch.cpp b/src/crepe/facade/SignalCatch.cpp
new file mode 100644
index 0000000..ad92d28
--- /dev/null
+++ b/src/crepe/facade/SignalCatch.cpp
@@ -0,0 +1,25 @@
+#include <stdexcept>
+
+#include "SignalCatch.h"
+
+using namespace crepe;
+using namespace std;
+
+SignalCatch::SignalCatch() {
+ segvcatch::init_segv(&SignalCatch::segv);
+ segvcatch::init_fpe(&SignalCatch::fpe);
+}
+
+SignalCatch::~SignalCatch() {
+ segvcatch::init_segv();
+ segvcatch::init_fpe();
+}
+
+void SignalCatch::segv() {
+ throw runtime_error("segmentation fault");
+}
+
+void SignalCatch::fpe() {
+ throw domain_error("floating point exception");
+}
+