Slightly improve logging

This commit is contained in:
Tom A. Wagner
2021-06-28 13:24:15 +02:00
parent edc4064009
commit b0bf5e5281

View File

@@ -6,6 +6,7 @@ use gtk::{
prelude::*, prelude::*,
subclass::prelude::*, subclass::prelude::*,
}; };
use log::{error, warn};
use std::collections::HashMap; use std::collections::HashMap;
@@ -249,6 +250,8 @@ impl GraphView {
let mut nodes = private.nodes.borrow_mut(); let mut nodes = private.nodes.borrow_mut();
if let Some(node) = nodes.remove(&id) { if let Some(node) = nodes.remove(&id) {
node.unparent(); node.unparent();
} else {
warn!("Tried to remove non-existant node (id={}) from graph", id);
} }
} }
@@ -258,11 +261,9 @@ impl GraphView {
if let Some(node) = private.nodes.borrow_mut().get_mut(&node_id) { if let Some(node) = private.nodes.borrow_mut().get_mut(&node_id) {
node.add_port(port_id, port); node.add_port(port_id, port);
} else { } else {
// FIXME: Log this instead error!(
log::error!(
"Node with id {} not found when trying to add port with id {} to graph", "Node with id {} not found when trying to add port with id {} to graph",
node_id, node_id, port_id
port_id
); );
} }
} }