Scarab  v2.4.4
Project 8 C++ Utility Library
test_terminate.cc
Go to the documentation of this file.
1 /*
2  * test_terminate.cc
3  *
4  * Created on: May 23, 2017
5  * Author: N.S. Oblath
6  */
7 
8 
9 #include "terminate.hh"
10 
11 #include "logger.hh"
12 
13 LOGGER( slog, "test_terminate" );
14 
15 namespace scarab
16 {
18  {
19  // throw an unhandled runtime error
20  throw std::runtime_error("RUNTIME ERROR!");
21  return 0;
22  }
23 
24  int foo2()
25  {
27  return 0;
28  }
29 
30  int foo1()
31  {
32  foo2();
33  return 0;
34  }
35 }
36 
37 int main(int , char ** )
38 {
39  // Use for option 2 (signal handling)
40  //struct sigaction sigact;
41 
42  //sigact.sa_sigaction = scarab::crit_err_hdlr;
43  //sigact.sa_flags = SA_RESTART | SA_SIGINFO;
44 
45  // set the error handler
46  //if( sigaction(SIGABRT, &sigact, (struct sigaction *)NULL) != 0 )
47  //{
48  // LERROR( slog, "error setting handler for signal " << SIGABRT
49  // << " (" << strsignal(SIGABRT) << ")" );
50  // exit(EXIT_FAILURE);
51  //}
52 
53  // cause the exception to be thrown
54  scarab::foo1();
55 
56  exit(EXIT_SUCCESS);
57 }
int throw_exception()
int main(int, char **)
LOGGER(slog, "test_terminate")
Contains the logger class and macros, based on Kasper&#39;s KLogger class.
int foo2()
int foo1()