feat: add UI feedback on http error and some logs

This commit is contained in:
Ian Chua
2026-05-19 13:46:12 +08:00
parent f78836bef4
commit 6aa7e9f4f5
2 changed files with 23 additions and 2 deletions

View File

@@ -4848,6 +4848,22 @@ void GUI_App::on_http_error(wxCommandEvent &evt)
}
return;
}
// Show general error notification for Orca Cloud API failures (not Bambu)
if (provider == ORCA_CLOUD_PROVIDER && status >= 400 && code != HttpErrorVersionLimited) {
if (m_show_http_errpr_msgdlg)
return;
m_show_http_errpr_msgdlg = true;
wxString msg;
if (!error.empty()) {
msg = wxString::Format(_L("API error (HTTP %u): %s"), status, wxString::FromUTF8(error));
} else {
msg = wxString::Format(_L("API error (HTTP %u)"), status);
}
wxMessageBox(msg, _L("Orca Cloud API Error"), wxOK | wxICON_ERROR, wxGetApp().mainframe);
m_show_http_errpr_msgdlg = false;
}
}
void GUI_App::enable_user_preset_folder(bool enable)

View File

@@ -1304,6 +1304,7 @@ void OrcaCloudServiceAgent::load_sync_state()
}
}
} catch (...) {
BOOST_LOG_TRIVIAL(warning) << "load_sync_state: failed to read sync state file, resetting timestamp to 0";
sync_state.last_sync_timestamp = 0;
}
}
@@ -1322,7 +1323,9 @@ void OrcaCloudServiceAgent::save_sync_state()
ofs.close();
boost::filesystem::rename(tmp_path, sync_state_path);
}
} catch (...) {}
} catch (...) {
BOOST_LOG_TRIVIAL(warning) << "save_sync_state: failed to write sync state file";
}
}
void OrcaCloudServiceAgent::clear_sync_state()
@@ -2230,7 +2233,9 @@ void OrcaCloudServiceAgent::json_to_map(const std::string& json, std::map<std::s
map[it.key()] = it.value().dump();
}
}
} catch (...) {}
} catch (...) {
BOOST_LOG_TRIVIAL(warning) << "json_to_map: failed to parse JSON";
}
}
// ============================================================================