Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: log postmessage errors #1426

Merged
merged 2 commits into from
Dec 31, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
rm getlasterror
  • Loading branch information
FabianLars committed Nov 26, 2024
commit bb5acc22d781173d356b6a5fe73f495c9d4b541a
14 changes: 9 additions & 5 deletions src/webview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,15 +1040,19 @@ impl InnerWebView {

let raw = Box::into_raw(boxed2);

let res = PostMessageW(hwnd, *EXEC_MSG_ID, WPARAM(raw as _), LPARAM(0));
let _res = PostMessageW(hwnd, *EXEC_MSG_ID, WPARAM(raw as _), LPARAM(0));

#[cfg(any(debug_assertions, feature = "tracing"))]
if res.is_err() {
let error_code = windows::Win32::Foundation::GetLastError();
if let Err(err) = _res {
let msg = format!(
"PostMessage failed ; is the messages queue full? Error code {} - {}",
err.code(),
err.message()
);
#[cfg(feature = "tracing")]
tracing::error!("PostMessage failed ; is the messages queue full? Error code {error_code:?}");
tracing::error!("{}", &msg);
#[cfg(debug_assertions)]
eprintln!("PostMessage failed ; is the messages queue full? {error_code:?}");
eprintln!("{}", msg);
}
}

Expand Down