Unhandled exception in reading TRC file

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Yu-Wei Chen
Posts: 13
Joined: Wed Jan 08, 2014 1:13 am

Unhandled exception in reading TRC file

Post by Yu-Wei Chen » Mon Mar 09, 2015 11:43 pm

Hello,

I encounter an unhandled exception in C++ code when reading a TRC file with bad data (for example, negative value of camera rate, no frame, or others), but I cannot catch this exception. Even if I use std::set_terminate, it does not work. I want to do a sanity check on TRC file so that OpenSim tool such as Scaling or IK will not get stuck if there are errors in TRC file. I need some help. Thank you very much.

Code: Select all

	string trcFile = "mypath\\test.trc";
	
	try {
		MarkerData markerData = MarkerData(trcFile);
		int numFrames = markerData.getNumFrames();
		cout << numFrames << endl;
	}

	catch (OpenSim::Exception ex)
    {
        std::cout << ex.getMessage() << std::endl;
        return 1;
    }
    catch (SimTK::Exception::Base ex)
    {
        std::cout << ex.getMessage() << std::endl;
        return 1;
    }
    catch (std::exception ex)
    {
        std::cout << ex.what() << std::endl;
        return 1;
    }
    catch (...)
    {
        std::cout << "UNRECOGNIZED EXCEPTION" << std::endl;
        return 1;
    }
Best regards,
Yu-Wei

POST REPLY