Skip to content

Commit

Permalink
stormlicht: improve top-level error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwuelker committed Aug 11, 2024
1 parent a20cb56 commit 953fbf7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions stormlicht/src/chrome/gtk/web_view/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::error::Report;

use glib::Object;
use gtk::{glib, subclass::prelude::*};
use url::URL;
Expand All @@ -16,12 +18,20 @@ impl WebView {

pub fn load(&self, url: &URL) {
if let Err(error) = self.imp().load_url(url) {
log::error!("Failed to load {url}: {error:?}");
log::error!(
"Failed to load {url}:\n{}",
Report::new(error).pretty(true).show_backtrace(true)
);
}
}

pub fn reload(&self) {
self.imp().reload().unwrap();
if let Err(error) = self.imp().reload() {
log::error!(
"Failed to refresh page:\n{}",
Report::new(error).pretty(true).show_backtrace(true)
);
}
}

pub fn handle_mouse_move(&self, x: f64, y: f64) {
Expand Down
2 changes: 1 addition & 1 deletion stormlicht/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![feature(panic_update_hook, cfg_match)]
#![feature(panic_update_hook, cfg_match, error_reporter)]

mod chrome;

Expand Down

0 comments on commit 953fbf7

Please sign in to comment.