From 42e060873b9c1a7e64393caf771aa5137b231b22 Mon Sep 17 00:00:00 2001 From: tavo Date: Wed, 3 Mar 2021 12:20:35 +0200 Subject: [PATCH] Add more logging to repo add --- src/main.rs | 2 +- src/repo/repo_manager.rs | 4 +++- src/sync/sync.rs | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index a4e03b3..1fb88d5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ #![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; -#[macro_use(info, warn)] extern crate log; +#[macro_use(info, warn, error)] extern crate log; mod server; mod gtm; diff --git a/src/repo/repo_manager.rs b/src/repo/repo_manager.rs index 2ac358e..b77a239 100644 --- a/src/repo/repo_manager.rs +++ b/src/repo/repo_manager.rs @@ -104,11 +104,13 @@ pub async fn add_repo(repo_dto: AddRepositoryDto) -> AddRepoDto { message: None, }; } + let error_msg = cloned_repo.err().map(|e| e.to_string()).unwrap_or_default(); + error!("Error adding repo: {}", &error_msg); return AddRepoDto { success: false, provider: None, user: None, repo: None, - message: cloned_repo.err().map(|e| e.to_string()), + message: Option::from(error_msg), }; } diff --git a/src/sync/sync.rs b/src/sync/sync.rs index 1370c3e..a7180c4 100644 --- a/src/sync/sync.rs +++ b/src/sync/sync.rs @@ -63,6 +63,7 @@ pub async fn sync_repo(provider: &String, user: &String, repo: &String) -> SyncS let res = sync_single(&repo_to_sync, &cfg, &client).await; // TODO: Check for error in json if res.is_err() || !res.unwrap().status().is_success() { + error!("Error syncing repo!"); return SyncSingleResult { error: Option::from("Error syncing repo!".to_string()), ok: false } } return SyncSingleResult { error: None, ok: true }