Changeset 166 for Evidence/Evidence.cc


Ignore:
Timestamp:
02/09/10 08:01:07 (15 years ago)
Author:
ogrimm
Message:
Update to exception handler
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Evidence/Evidence.cc

    r165 r166  
    199199        abort();
    200200  }
    201   else {
    202         Terminating = true;
    203 
    204         // Make sure there was an exception; terminate is also called for an
    205         // attempt to rethrow when there is no suitable exception.
    206         type_info *Type = abi::__cxa_current_exception_type();
    207         if (Type != NULL) {
    208           int Status = -1;
    209           char *Demangled = NULL;
    210 
    211           Demangled = abi::__cxa_demangle(Type->name(), 0, 0, &Status);
    212           snprintf(Msg, sizeof(Msg), "%s: Terminate() called after throwing an instance of '%s'", ThisServer->Status->getName(), Status==0 ? Demangled : Type->name());
    213           free(Demangled);
    214 
    215           // If exception derived from std::exception, more information.
    216           try { __throw_exception_again; }
    217           catch (exception &E) {
    218                 snprintf(Msg+strlen(Msg), sizeof(Msg)-strlen(Msg), " (what(): %s)", E.what());   
    219           }
    220           catch (...) { }
     201
     202  Terminating = true;
     203
     204  // Make sure there was an exception; terminate is also called for an
     205  // attempt to rethrow when there is no suitable exception.
     206  type_info *Type = abi::__cxa_current_exception_type();
     207  if (Type != NULL) {
     208        int Status = -1;
     209        char *Demangled = NULL;
     210
     211        Demangled = abi::__cxa_demangle(Type->name(), 0, 0, &Status);
     212        snprintf(Msg, sizeof(Msg), "Terminate() called after throwing an instance of '%s'", Status==0 ? Demangled : Type->name());
     213        free(Demangled);
     214
     215        // If exception derived from std::exception, more information.
     216        try { __throw_exception_again; }
     217        catch (exception &E) {
     218          snprintf(Msg+strlen(Msg), sizeof(Msg)-strlen(Msg), " (what(): %s)", E.what());         
    221219        }
    222         else snprintf(Msg, sizeof(Msg), "%s: Terminate() called without an active exception", ThisServer->Status->getName());
    223   }
     220        catch (...) { }
     221  }
     222  else snprintf(Msg, sizeof(Msg), "Terminate() called without an active exception");
    224223
    225224  ThisServer->State(FATAL, Msg);
Note: See TracChangeset for help on using the changeset viewer.