Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 18, 2010, 12:08:05 AM (14 years ago)
Author:
rgrieder
Message:

Only catch exceptions you actually expect. And rethrow unknown exceptions ("…" can also catch internal Microsoft exceptions like floating point exception).

Location:
code/trunk/src/libraries/core/input
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/input/InputDevice.h

    r6746 r7174  
    4040#include <vector>
    4141#include <ois/OISInputManager.h>
     42#include <ois/OISException.h>
    4243
    4344#include "util/Clock.h"
     
    144145                oisInputManager_->destroyInputObject(oisDevice_);
    145146            }
    146             catch (...)
     147            catch (const OIS::Exception& ex)
    147148            {
    148                 COUT(1) << this->getClassName() << " destruction failed: " << Exception::handleMessage() << std::endl
     149                COUT(1) << this->getClassName() << " destruction failed: " << ex.eText << std::endl
    149150                        << "    Potential resource leak!" << std::endl;
    150151            }
  • code/trunk/src/libraries/core/input/InputManager.cc

    r6746 r7174  
    306306                continue;
    307307            const std::string& className = device->getClassName();
    308             try
    309             {
    310                 delete device;
    311                 device = 0;
    312                 CCOUT(4) << className << " destroyed." << std::endl;
    313             }
    314             catch (...)
    315             {
    316                 COUT(1) << className << " destruction failed: " << Exception::handleMessage() << std::endl
    317                         << "    Potential resource leak!" << std::endl;
    318             }
     308            delete device;
     309            device = 0;
     310            CCOUT(4) << className << " destroyed." << std::endl;
    319311        }
    320312        devices_.resize(InputDeviceEnumerator::FirstJoyStick);
     
    325317            OIS::InputManager::destroyInputSystem(oisInputManager_);
    326318        }
    327         catch (...)
    328         {
    329             COUT(1) << "OIS::InputManager destruction failed" << Exception::handleMessage() << std::endl
     319        catch (const OIS::Exception& ex)
     320        {
     321            COUT(1) << "OIS::InputManager destruction failed" << ex.eText << std::endl
    330322                    << "    Potential resource leak!" << std::endl;
    331323        }
Note: See TracChangeset for help on using the changeset viewer.