mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 08:54:34 +00:00
Handle load failure exceptions.
This commit is contained in:
parent
5062bef69a
commit
b262cb2428
@ -766,6 +766,11 @@ static void DrawContents()
|
||||
badVer.state = tracy::BadVersionState::LegacyVersion;
|
||||
badVer.version = e.version;
|
||||
}
|
||||
catch( const tracy::LoadFailure& e )
|
||||
{
|
||||
badVer.state = tracy::BadVersionState::LoadFailure;
|
||||
badVer.msg = e.msg;
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ void BadVersionImpl( BadVersionState& badVer, ImFont* big )
|
||||
case BadVersionState::LegacyVersion:
|
||||
ImGui::OpenPopup( "Legacy file version" );
|
||||
break;
|
||||
case BadVersionState::LoadFailure:
|
||||
ImGui::OpenPopup( "Trace load failure" );
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
break;
|
||||
@ -98,6 +101,22 @@ void BadVersionImpl( BadVersionState& badVer, ImFont* big )
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
if( ImGui::BeginPopupModal( "Trace load failure", nullptr, ImGuiWindowFlags_AlwaysAutoResize ) )
|
||||
{
|
||||
ImGui::PushFont( big );
|
||||
TextCentered( ICON_FA_BOMB );
|
||||
ImGui::PopFont();
|
||||
ImGui::TextUnformatted( "The file you are trying to open is corrupted." );
|
||||
ImGui::Spacing();
|
||||
ImGui::TextUnformatted( badVer.msg.c_str() );
|
||||
ImGui::Separator();
|
||||
if( ImGui::Button( "OK" ) )
|
||||
{
|
||||
ImGui::CloseCurrentPopup();
|
||||
badVer.state = BadVersionState::Ok;
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user