Scarab  v2.4.6
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 #include "terminate.hh"
9 
10 #include "logger.hh"
11 
12 LOGGER( slog, "test_terminate" );
13 
14 namespace scarab
15 {
17  {
18  // throw an unhandled runtime error
19  throw std::runtime_error("RUNTIME ERROR!");
20  return 0;
21  }
22 
23  int foo2()
24  {
26  return 0;
27  }
28 
29  int foo1()
30  {
31  foo2();
32  return 0;
33  }
34 }
35 
36 int main(int , char ** )
37 {
38  // Use for option 2 (signal handling)
39  //struct sigaction sigact;
40 
41  //sigact.sa_sigaction = scarab::crit_err_hdlr;
42  //sigact.sa_flags = SA_RESTART | SA_SIGINFO;
43 
44  // set the error handler
45  //if( sigaction(SIGABRT, &sigact, (struct sigaction *)NULL) != 0 )
46  //{
47  // LERROR( slog, "error setting handler for signal " << SIGABRT
48  // << " (" << strsignal(SIGABRT) << ")" );
49  // exit(EXIT_FAILURE);
50  //}
51 
52  // cause the exception to be thrown
53  scarab::foo1();
54 
55  exit(EXIT_SUCCESS);
56 }
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()