Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 19, 2009, 11:17:51 PM (15 years ago)
Author:
rgrieder
Message:

Added Exception::handleMessage() (copy from Game::getExceptionMessage) function that returns the exception message (if retrievable) when catching with "…"
and adjusted some exception handlers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/util/Exception.cc

    r5738 r5747  
    3434
    3535#include "Exception.h"
     36#include <CEGUIExceptions.h>
    3637
    3738namespace orxonox
     
    9394        return getDescription().c_str();
    9495    }
     96
     97    /*static*/ std::string Exception::handleMessage()
     98    {
     99        try
     100        {
     101            // rethrow
     102            throw;
     103        }
     104        catch (const std::exception& ex)
     105        {
     106            return ex.what();
     107        }
     108        catch (const CEGUI::Exception& ex)
     109        {
     110#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
     111            return GeneralException(ex.getMessage().c_str()).getDescription();
     112#else
     113            return GeneralException(ex.getMessage().c_str(), ex.getLine(),
     114                ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
     115#endif
     116        }
     117        catch (...)
     118        {
     119            return "Unknown exception";
     120        }
     121    }
    95122}
Note: See TracChangeset for help on using the changeset viewer.