mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-25 23:44:35 +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.state = tracy::BadVersionState::LegacyVersion;
|
||||||
badVer.version = e.version;
|
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:
|
case BadVersionState::LegacyVersion:
|
||||||
ImGui::OpenPopup( "Legacy file version" );
|
ImGui::OpenPopup( "Legacy file version" );
|
||||||
break;
|
break;
|
||||||
|
case BadVersionState::LoadFailure:
|
||||||
|
ImGui::OpenPopup( "Trace load failure" );
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert( false );
|
assert( false );
|
||||||
break;
|
break;
|
||||||
@ -98,6 +101,22 @@ void BadVersionImpl( BadVersionState& badVer, ImFont* big )
|
|||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
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