Skip to content

Commit

Permalink
Add more logging to repo add
Browse files Browse the repository at this point in the history
  • Loading branch information
kilpkonn committed Mar 3, 2021
1 parent 4a71048 commit 42e0608
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
4 changes: 3 additions & 1 deletion src/repo/repo_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
};
}
1 change: 1 addition & 0 deletions src/sync/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down

0 comments on commit 42e0608

Please sign in to comment.