Project load: say WHY the CAD model could not be restored

deserialize_recipe distinguishes three cases that matter very differently to the
person reading the message — saved by a NEWER build, saved by an OLDER one, or
genuinely unreadable — and names the version in each. load_recipe threw all of
that away and printed one generic sentence, so the user could not tell "update
SnapOrca" from "your file is damaged", and had no way to find out.

Same error-loss class as the 31 McpControl sites fixed in 1de72de9ed: the message
existed, it was simply not passed on. The generic sentence stays as the fallback
for the case where the kernel really has nothing to say.

This does not make old projects loadable — that is snaporca-2txy, which the audit
behind this change opened. It only stops the reason being withheld.

snaporca-2txy (partial). Reviewed and compiled (RC=0), not exercised.
This commit is contained in:
Tommaso Bianchi
2026-08-13 09:01:18 +02:00
parent 7245415af7
commit 4b3ff99004
+11 -1
View File
@@ -6094,7 +6094,17 @@ void DesignPanel::load_recipe(const std::string& blob)
{
if (blob.empty()) return;
if (!m_doc.deserialize_recipe(blob)) {
set_status(_L("Could not restore the CAD model from this project"));
// Carry the kernel's reason. deserialize_recipe distinguishes three cases that matter
// very differently to the person reading this — saved by a NEWER build, saved by an
// OLDER one, or genuinely unreadable — and replacing all three with one sentence left
// the user unable to tell "update SnapOrca" from "your file is damaged". Same
// error-loss class as the 31 McpControl sites (1de72de9ed): the message exists, it was
// simply not passed on.
m_status->SetForegroundColour(wxColour(235, 110, 110));
set_status(m_doc.error.empty()
? _L("Could not restore the CAD model from this project")
: _L("Could not restore the CAD model: ") + wxString::FromUTF8(m_doc.error));
m_status->Refresh();
return;
}
m_feature_counter = int(m_doc.features.size());