Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/slic3r/GUI/DownloadManager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "DownloadManager.hpp"
#include "GUI_App.hpp"
#include "libslic3r/Utils.hpp"
#include <boost/filesystem.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/log/trivial.hpp>
Expand Down Expand Up @@ -257,6 +258,8 @@ void DownloadManager::start_download_impl(std::shared_ptr<DownloadTask> task) {
if (!file.is_open()) {
std::string error_msg = "Failed to open file for writing: " + task->dest_path;
BOOST_LOG_TRIVIAL(error) << "DownloadManager: " << error_msg;
// Flush logs immediately for critical errors
Slic3r::flush_logs();
send_error_update(task, error_msg);
cleanup_task(task->task_id);
return;
Expand All @@ -266,6 +269,8 @@ void DownloadManager::start_download_impl(std::shared_ptr<DownloadTask> task) {
if (file.fail()) {
std::string error_msg = "Failed to write file: " + task->dest_path;
BOOST_LOG_TRIVIAL(error) << "DownloadManager: " << error_msg << ", body size: " << body.size();
// Flush logs immediately for critical errors
Slic3r::flush_logs();
file.close();
send_error_update(task, error_msg);
cleanup_task(task->task_id);
Expand All @@ -280,6 +285,8 @@ void DownloadManager::start_download_impl(std::shared_ptr<DownloadTask> task) {
} catch (std::exception& e) {
std::string error_msg = std::string("File write exception: ") + e.what();
BOOST_LOG_TRIVIAL(error) << "DownloadManager: " << error_msg << ", file: " << task->dest_path;
// Flush logs immediately for critical errors
Slic3r::flush_logs();
send_error_update(task, error_msg);
cleanup_task(task->task_id);
}
Expand All @@ -301,6 +308,8 @@ void DownloadManager::start_download_impl(std::shared_ptr<DownloadTask> task) {
<< ", URL: " << task->file_url
<< ", file: " << task->file_name
<< ", dest: " << task->dest_path;
// Flush logs immediately for critical errors to ensure they are written
Slic3r::flush_logs();
task->state = DownloadTaskState::Error;
task->error_message = error;
send_error_update(task, error);
Expand Down
3 changes: 3 additions & 0 deletions src/slic3r/GUI/GenericDownloadDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ void GenericDownloadDialog::on_download_error(size_t task_id, const std::string&

void GenericDownloadDialog::on_retry_clicked(wxCommandEvent& event)
{
SetTitle(m_title);
if (m_on_retry) {
m_on_retry();
}
Expand Down Expand Up @@ -399,6 +400,8 @@ void GenericDownloadDialog::show_error_page(const std::string& error_msg)
{
m_simplebook_status->SetSelection(2);

SetTitle(_L("Donwload failed"));

// Display simple error message: filename + "Download failed"
wxString filename = wxString::FromUTF8(m_file_name.c_str());
wxString error_text = filename + " - Download failed";
Expand Down
6 changes: 6 additions & 0 deletions src/slic3r/GUI/MainFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4038,6 +4038,12 @@ void MainFrame::downloadOpenProject(const std::string& fileUrl, const std::strin
wxGetApp().mainframe->plater()->load_project(wx_file_path);
}
}
else
{
// Not a valid 3mf file, show error message
wxString msg = wxString::Format(_L("The downloaded file '%s' is not a valid 3MF project file."), fileName);
MessageDialog(this, msg, _L("Invalid File"), wxOK | wxICON_WARNING).ShowModal();
}


}
Expand Down
Loading