feature add bury point for webview init.

This commit is contained in:
alves
2026-01-14 11:07:26 +08:00
parent dab81c330b
commit 2519603b3d
11 changed files with 45 additions and 34 deletions

View File

@@ -8,6 +8,7 @@
#include "I18N.hpp" #include "I18N.hpp"
#include <wx/display.h> #include <wx/display.h>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace fs = boost::filesystem; namespace fs = boost::filesystem;
@@ -268,6 +269,19 @@ void MarkdownTip::OnTitleChanged(wxWebViewEvent& event)
} }
void MarkdownTip::OnError(wxWebViewEvent& event) void MarkdownTip::OnError(wxWebViewEvent& event)
{ {
auto e = "unknown error";
switch (event.GetInt()) {
case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
}
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":MarkdownTip error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init MarkdownTip webview fail", BP_WEB_VIEW);
} }
void MarkdownTip::OnTimer(wxTimerEvent& event) void MarkdownTip::OnTimer(wxTimerEvent& event)

View File

@@ -15,6 +15,7 @@
#include <slic3r/GUI/Widgets/WebView.hpp> #include <slic3r/GUI/Widgets/WebView.hpp>
#include <wx/webview.h> #include <wx/webview.h>
#include "slic3r/GUI/SSWCP.hpp" #include "slic3r/GUI/SSWCP.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
namespace pt = boost::property_tree; namespace pt = boost::property_tree;
@@ -184,6 +185,7 @@ void PrinterWebView::OnError(wxWebViewEvent &evt)
break; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") %evt.GetURL() %evt.GetTarget() %e %evt.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") %evt.GetURL() %evt.GetTarget() %e %evt.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init PrinterWebView webview fail", BP_WEB_VIEW);
} }
void PrinterWebView::OnLoaded(wxWebViewEvent &evt) void PrinterWebView::OnLoaded(wxWebViewEvent &evt)

View File

@@ -24,6 +24,7 @@
#include "Plater.hpp" #include "Plater.hpp"
#include "BitmapCache.hpp" #include "BitmapCache.hpp"
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
@@ -457,6 +458,7 @@ void UpdateVersionDialog::OnError(wxWebViewEvent& event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":UpdateVersionDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e %event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":UpdateVersionDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e %event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init UpdateVersionDialog webview fail", BP_WEB_VIEW);
event.Skip(); event.Skip();
} }

View File

@@ -5,6 +5,7 @@
#include "SSWCP.hpp" #include "SSWCP.hpp"
#include <wx/sizer.h> #include <wx/sizer.h>
#include <slic3r/GUI/Widgets/WebView.hpp> #include <slic3r/GUI/Widgets/WebView.hpp>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
@@ -117,7 +118,7 @@ void WebDeviceDialog::OnError(wxWebViewEvent &evt)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebDeviceDialog error loading page %1% %2% %3% %4%") % evt.GetURL() % evt.GetTarget() % e %evt.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebDeviceDialog error loading page %1% %2% %3% %4%") % evt.GetURL() % evt.GetTarget() % e %evt.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebDeviceDialog webview fail", BP_WEB_VIEW);
} }
void WebDeviceDialog::OnScriptMessage(wxWebViewEvent &evt) void WebDeviceDialog::OnScriptMessage(wxWebViewEvent &evt)

View File

@@ -34,7 +34,7 @@
#include <libslic3r/Utils.hpp> #include <libslic3r/Utils.hpp>
#include "CreatePresetsDialog.hpp" #include "CreatePresetsDialog.hpp"
#include <mutex> #include <mutex>
#include "bury_cfg/bury_point.hpp" #include "sentry_wrapper/SentryWrapper.hpp"
using namespace nlohmann; using namespace nlohmann;
@@ -611,6 +611,7 @@ void GuideFrame::OnError(wxWebViewEvent& event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":GuideFrame error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":GuideFrame error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init GuideFrame webview fail", BP_WEB_VIEW);
} }
void GuideFrame::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt)) void GuideFrame::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))

View File

@@ -6,6 +6,7 @@
#include <wx/sizer.h> #include <wx/sizer.h>
#include <slic3r/GUI/Widgets/WebView.hpp> #include <slic3r/GUI/Widgets/WebView.hpp>
#include "NotificationManager.hpp" #include "NotificationManager.hpp"
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
@@ -166,6 +167,7 @@ void WebPreprintDialog::OnError(wxWebViewEvent &event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPreprintDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPreprintDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebPreprintDialog webview fail", BP_WEB_VIEW);
} }
void WebPreprintDialog::OnScriptMessage(wxWebViewEvent &evt) void WebPreprintDialog::OnScriptMessage(wxWebViewEvent &evt)

View File

@@ -6,7 +6,7 @@
#include "libslic3r/AppConfig.hpp" #include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
#include "common_func/common_func.hpp" #include "sentry_wrapper/SentryWrapper.hpp"
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/toolbar.h> #include <wx/toolbar.h>
@@ -707,6 +707,7 @@ void WebPresetDialog::OnError(wxWebViewEvent& event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPresetDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebPresetDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebPresetDialog webview fail", BP_WEB_VIEW);
} }
void WebPresetDialog::OnScriptResponseMessage(wxCommandEvent& WXUNUSED(evt)) void WebPresetDialog::OnScriptResponseMessage(wxCommandEvent& WXUNUSED(evt))

View File

@@ -401,6 +401,7 @@ void SMUserLogin::OnError(wxWebViewEvent &event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":SMUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":SMUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init SMUserLogin webview fail", BP_WEB_VIEW);
} }
void SMUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt)) void SMUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))

View File

@@ -6,6 +6,7 @@
#include "SSWCP.hpp" #include "SSWCP.hpp"
#include <wx/sizer.h> #include <wx/sizer.h>
#include <slic3r/GUI/Widgets/WebView.hpp> #include <slic3r/GUI/Widgets/WebView.hpp>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r { namespace GUI { namespace Slic3r { namespace GUI {
@@ -129,6 +130,7 @@ void WebUrlDialog::OnError(wxWebViewEvent &event)
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebUrlDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":WebUrlDialog error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebUrlDialog webview fail", BP_WEB_VIEW);
} }
void WebUrlDialog::OnScriptMessage(wxWebViewEvent &evt) void WebUrlDialog::OnScriptMessage(wxWebViewEvent &evt)

View File

@@ -5,7 +5,7 @@
#include "libslic3r/AppConfig.hpp" #include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
#include "common_func/common_func.hpp" #include "sentry_wrapper/SentryWrapper.hpp"
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/toolbar.h> #include <wx/toolbar.h>
@@ -375,6 +375,7 @@ void ZUserLogin::OnError(wxWebViewEvent &event)
case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break; case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":ZUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString(); BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":ZUserLogin error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init ZUserLogin webview fail", BP_WEB_VIEW);
} }
void ZUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt)) void ZUserLogin::OnScriptResponseMessage(wxCommandEvent &WXUNUSED(evt))

View File

@@ -4,7 +4,7 @@
#include "slic3r/GUI/wxExtensions.hpp" #include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp" #include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp" #include "slic3r/GUI/MainFrame.hpp"
#include "common_func/common_func.hpp" #include "sentry_wrapper/SentryWrapper.hpp"
#include "../Utils/Http.hpp" #include "../Utils/Http.hpp"
#include "SSWCP.hpp" #include "SSWCP.hpp"
@@ -894,37 +894,21 @@ void WebViewPanel::OnSelectAll(wxCommandEvent& WXUNUSED(evt))
/** /**
* Callback invoked when a loading error occurs * Callback invoked when a loading error occurs
*/ */
void WebViewPanel::OnError(wxWebViewEvent& evt) void WebViewPanel::OnError(wxWebViewEvent& event)
{ {
#define WX_ERROR_CASE(type) \ auto e = "unknown error";
case type: \ switch (event.GetInt()) {
category = #type; \ case wxWEBVIEW_NAV_ERR_CONNECTION: e = "wxWEBVIEW_NAV_ERR_CONNECTION"; break;
break; case wxWEBVIEW_NAV_ERR_CERTIFICATE: e = "wxWEBVIEW_NAV_ERR_CERTIFICATE"; break;
case wxWEBVIEW_NAV_ERR_AUTH: e = "wxWEBVIEW_NAV_ERR_AUTH"; break;
wxString category; case wxWEBVIEW_NAV_ERR_SECURITY: e = "wxWEBVIEW_NAV_ERR_SECURITY"; break;
switch (evt.GetInt()) case wxWEBVIEW_NAV_ERR_NOT_FOUND: e = "wxWEBVIEW_NAV_ERR_NOT_FOUND"; break;
{ case wxWEBVIEW_NAV_ERR_REQUEST: e = "wxWEBVIEW_NAV_ERR_REQUEST"; break;
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CONNECTION); case wxWEBVIEW_NAV_ERR_USER_CANCELLED: e = "wxWEBVIEW_NAV_ERR_USER_CANCELLED"; break;
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_CERTIFICATE); case wxWEBVIEW_NAV_ERR_OTHER: e = "wxWEBVIEW_NAV_ERR_OTHER"; break;
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_AUTH);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_SECURITY);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_NOT_FOUND);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_REQUEST);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_USER_CANCELLED);
WX_ERROR_CASE(wxWEBVIEW_NAV_ERR_OTHER);
} }
BOOST_LOG_TRIVIAL(fatal) << __FUNCTION__<< boost::format(":PrinterWebView error loading page %1% %2% %3% %4%") % event.GetURL() % event.GetTarget() %e % event.GetString();
BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << ": [" << category << "] " << evt.GetString().ToUTF8().data(); Slic3r::sentryReportLog(Slic3r::SENTRY_LOG_FATAL, "bury_point_init WebViewPanel webview fail", BP_WEB_VIEW);
if (wxGetApp().get_mode() == comDevelop)
{
wxLogMessage("%s", "Error; url='" + evt.GetURL() + "', error='" + category + " (" + evt.GetString() + ")'");
// Show the info bar with an error
m_info->ShowMessage(_L("An error occurred loading ") + evt.GetURL() + "\n" + "'" + category + "'", wxICON_ERROR);
}
UpdateState();
} }