Skip to content

Commit

Permalink
print all possible err of loading theme
Browse files Browse the repository at this point in the history
  • Loading branch information
extrawurst committed Feb 20, 2024
1 parent 4c41e18 commit da610e7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
1 change: 0 additions & 1 deletion asyncgit/src/sync/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ pub fn tag_commit(

#[cfg(test)]
mod tests {

use crate::error::Result;
use crate::sync::tags::Tag;
use crate::sync::RepoPath;
Expand Down
13 changes: 5 additions & 8 deletions src/ui/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,13 +274,7 @@ impl Theme {
fn load_patch(theme_path: &PathBuf) -> Result<ThemePatch> {
let file = File::open(theme_path)?;

let load_result = ron::de::from_reader(file);

if let Err(e) = &load_result {
log::error!("theme error [{:?}]: {e}", theme_path);
}

Ok(load_result?)
Ok(ron::de::from_reader(file)?)
}

fn load_old_theme(theme_path: &PathBuf) -> Result<Self> {
Expand All @@ -303,7 +297,10 @@ impl Theme {
pub fn init(theme_path: &PathBuf) -> Self {
let mut theme = Self::default();

if let Ok(patch) = Self::load_patch(theme_path) {
if let Ok(patch) = Self::load_patch(theme_path).map_err(|e| {
log::error!("theme error [{:?}]: {e}", theme_path);
e
}) {
theme.apply(patch);
} else if let Ok(old_theme) = Self::load_old_theme(theme_path)
{
Expand Down

0 comments on commit da610e7

Please sign in to comment.