Print error message when opening a trace from command line fails.

This commit is contained in:
Bartosz Taudul 2024-02-03 16:25:01 +01:00
parent 1354205db8
commit 5461427493
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -217,7 +217,25 @@ int main( int argc, char** argv )
printf( " %s -a address [-p port]\n", argv[0] );
exit( 0 );
}
initFileOpen = std::unique_ptr<tracy::FileRead>( tracy::FileRead::Open( argv[1] ) );
try
{
initFileOpen = std::unique_ptr<tracy::FileRead>( tracy::FileRead::Open( argv[1] ) );
}
catch( const tracy::UnsupportedVersion& e )
{
fprintf( stderr, "The file you are trying to open is from the future version.\n" );
exit( 1 );
}
catch( const tracy::NotTracyDump& e )
{
fprintf( stderr, "The file you are trying to open is not a tracy dump.\n" );
exit( 1 );
}
catch( const tracy::LegacyVersion& e )
{
fprintf( stderr, "The file you are trying to open is from a legacy version.\n" );
exit( 1 );
}
if( !initFileOpen )
{
fprintf( stderr, "Cannot open trace file: %s\n", argv[1] );