Add debugging output in handle_external_linking()

This commit is contained in:
Matthias Beyer 2016-04-12 22:27:57 +02:00
parent b9800ba008
commit 0c970263ce

View file

@ -194,21 +194,25 @@ fn handle_external_linking(rt: &Runtime) {
let mut entry = entry.unwrap(); let mut entry = entry.unwrap();
if scmd.is_present("add") { if scmd.is_present("add") {
debug!("Adding link to entry!");
add_link_to_entry(rt.store(), scmd, &mut entry); add_link_to_entry(rt.store(), scmd, &mut entry);
return; return;
} }
if scmd.is_present("remove") { if scmd.is_present("remove") {
debug!("Removing link from entry!");
remove_link_from_entry(rt.store(), scmd, &mut entry); remove_link_from_entry(rt.store(), scmd, &mut entry);
return; return;
} }
if scmd.is_present("set") { if scmd.is_present("set") {
debug!("Setting links in entry!");
set_links_for_entry(rt.store(), scmd, &mut entry); set_links_for_entry(rt.store(), scmd, &mut entry);
return; return;
} }
if scmd.is_present("list") { if scmd.is_present("list") {
debug!("Listing links in entry!");
list_links_for_entry(rt.store(), &mut entry); list_links_for_entry(rt.store(), &mut entry);
return; return;
} }
@ -221,14 +225,18 @@ fn add_link_to_entry(store: &Store, matches: &ArgMatches, entry: &mut FileLockEn
let link = Url::parse(link); let link = Url::parse(link);
if link.is_err() { if link.is_err() {
debug!("URL parsing error...");
trace_error(&link.err().unwrap()); trace_error(&link.err().unwrap());
debug!("Exiting");
exit(1); exit(1);
} }
let link = link.unwrap(); let link = link.unwrap();
if let Err(e) = entry.add_external_link(store, link) { if let Err(e) = entry.add_external_link(store, link) {
debug!("Error while adding external link...");
trace_error(&e); trace_error(&e);
} else { } else {
debug!("Everything worked well");
info!("Ok"); info!("Ok");
} }
} }