Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2305 for code/branches


Ignore:
Timestamp:
Dec 2, 2008, 4:53:34 PM (16 years ago)
Author:
rgrieder
Message:
  • Exported Exception displaying to an inline function instead of the exception constructor. This will make things easier with the SpecificExceptions. Going to do that when merging with OH2.
  • Added abort() statement to the global exception "try" in RootGameState
  • Changed global exception "try" to be activated always except when using the msvc debugger.
Location:
code/branches/physics/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/core/RootGameState.cc

    r2103 r2305  
    130130    void RootGameState::start()
    131131    {
    132 #ifdef NDEBUG
     132        // Don't catch errors when having a debugger in msvc
     133#if ORXONOX_COMPILER != ORXONOX_COMPILER_MSVC || defined(NDEBUG)
    133134        try
    134135        {
     
    156157
    157158            this->deactivate();
    158 #ifdef NDEBUG
     159#if ORXONOX_COMPILER != ORXONOX_COMPILER_MSVC || defined(NDEBUG)
    159160        }
    160161        // Note: These are all unhandled exceptions that should not have made its way here!
     
    162163        catch (std::exception& ex)
    163164        {
    164             COUT(1) << ex.what() << std::endl;
    165             COUT(1) << "Program aborted." << std::endl;
     165            COUT(0) << ex.what() << std::endl;
     166            COUT(0) << "Program aborted." << std::endl;
     167            abort();
    166168        }
    167169        // anything that doesn't inherit from std::exception
    168170        catch (...)
    169171        {
    170             COUT(1) << "An unidentifiable exception has occured. Program aborted." << std::endl;
     172            COUT(0) << "An unidentifiable exception has occured. Program aborted." << std::endl;
     173            abort();
    171174        }
    172175#endif
  • code/branches/physics/src/util/Exception.h

    r2298 r2305  
    103103                  : Exception(description, lineNumber, filename, functionName)
    104104        {
    105             // let the catcher decide whether to display the message below level 4
    106             COUT(4) << this->getFullDescription() << std::endl;
    107105        }
    108106
     
    110108            : Exception(description)
    111109        {
    112             // let the catcher decide whether to display the message below level 4
    113             COUT(4) << this->getFullDescription() << std::endl;
    114110        }
    115111
     
    148144    CREATE_ORXONOX_EXCEPTION(GameState);
    149145
     146    /**
     147    @brief
     148        Helper function that creates an exception, displays the message, but doesn't throw it.
     149    */
     150    template <class T>
     151    inline const T& InternalHandleException(const T& exception)
     152    {
     153        // let the catcher decide whether to display the message below level 4
     154        COUT(4) << exception.getFullDescription() << std::endl;
     155        return exception;
     156    }
     157
    150158#define ThrowException(type, description) \
    151     throw SpecificException<Exception::type>(description, __LINE__, __FILE__, __FUNCTIONNAME__)
     159    throw InternalHandleException(SpecificException<Exception::type>(description, __LINE__, __FILE__, __FUNCTIONNAME__))
    152160
    153161    // define an assert macro that can display a message
Note: See TracChangeset for help on using the changeset viewer.