From 34eb926f1509a1757906bb223e4f40108bc36538 Mon Sep 17 00:00:00 2001 From: Aloxaf Date: Wed, 4 Nov 2020 10:17:30 +0800 Subject: [PATCH] fix: make error message not so confusing --- src/config.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 37d34ec..92a0c72 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,6 +1,6 @@ use crate::formatter::{ImageFormatter, ImageFormatterBuilder}; use crate::utils::{Background, ShadowAdder, ToRgba}; -use anyhow::Error; +use anyhow::{Context, Error}; use clipboard::{ClipboardContext, ClipboardProvider}; use image::Rgba; use std::fs::File; @@ -216,7 +216,8 @@ impl Config { if let Some(theme) = ts.themes.get(&self.theme) { Ok(theme.clone()) } else { - Ok(ThemeSet::get_theme(&self.theme)?) + ThemeSet::get_theme(&self.theme) + .context(format!("Canot load the theme: {}", self.theme)) } }