TestSingO(Symbol ty="TestSingO")
   : callCnt_(0)
   , typid_(ty)
   , msg_("%s::doIt() call=%d\n")
   {
     TRACE (test, "ctor %s", typid_.c());
   }
Exemplo n.º 2
0
 /** @param name to use in log and error messages
  *  @note  does error handling, but delegates the actual
  *         execution to the protected (subclass) member */
 ExecResult
 HandlingPattern::invoke (CommandImpl& command, Symbol name)  const
 {
   TRACE (proc_dbg, "invoking %s...", name.c());
   static format err_pre ("Error state detected, %s *NOT* invoked.");
   static format err_post ("Error state after %s invocation.");
   static format err_fatal ("Execution of %s raised unknown error.");
   try
     {
       Symbol errID_pre = lumiera_error();
       if (errID_pre)
         return ExecResult (error::Logic (str (err_pre % command), errID_pre));
       
       // execute or undo it...
       perform (command);
       
       Symbol errID = lumiera_error();
       if (errID)
         return ExecResult (error::State (str (err_post % command),errID));
       else
         return ExecResult();
     }
   
   
   catch (lumiera::Error& problem)
     {
       Symbol errID = lumiera_error();
       WARN (command, "Invocation of %s failed: %s", name.c(), problem.what());
       TRACE (proc_dbg, "Error flag was: %s", errID.c());
       return ExecResult (problem);
     }
   catch (std::exception& library_problem)
     {
       Symbol errID = lumiera_error();
       WARN (command, "Invocation of %s failed: %s", name.c(), library_problem.what());
       TRACE (proc_dbg, "Error flag was: %s", errID.c());
       return ExecResult (error::External (library_problem));
     }
   catch (...)
     {
       Symbol errID = lumiera_error();
       ERROR (command, "Invocation of %s failed with unknown exception; error flag is: %s", name.c(), errID.c());
       throw error::Fatal (str (err_fatal % command), errID);
     }
 }
  virtual
 ~TestSingO()
    {
      TRACE (test, "dtor %s", typid_.c());
    }