Skip to content
Snippets Groups Projects
Verified Commit 0e62abfa authored by Volkor Barbarian Warrior's avatar Volkor Barbarian Warrior
Browse files

add some better logging to db

parent 52f4acdb
No related branches found
No related tags found
No related merge requests found
use chrono::DateTime;
use chrono_humanize::HumanTime;
use egui_extras::{Column, TableBuilder};
use figment::providers::Data;
use log::{error, info};
use longitude::{DistanceUnit, Location};
use meshtastic::protobufs::{channel::Role, HardwareModel, Position};
......@@ -45,7 +47,15 @@ pub(crate) fn calc_distance_to_node(away: Position) -> Option<f64> {
/// UI Elements for the Node List
pub fn nodelist_ui(ui: &mut egui::Ui) {
// Get nodes from DB
let mut nodes = Database::read_node_list().expect("Failed to read nodes");
let mut nodes = Database::read_node_list().unwrap_or_else(|e| {
error!("Failed to read nodes: {}", e);
// Return a default value or handle the error as needed
Vec::new() // Example default value, replace with appropriate handling
});
info!("Loaded {} nodes from DB", nodes.len());
// let mut nodes = Database::read_node_list().expect("Failed to read nodes");
// Sort nodes by `last_heard` in descending order
nodes.sort_by(|a, b| b.last_heard.cmp(&a.last_heard));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment