aboutsummaryrefslogtreecommitdiffstats
path: root/config/ui.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2024-02-12 11:04:29 +0100
committerRobin Jarry <robin@jarry.cc>2024-02-14 23:05:15 +0100
commitabfb20f1d62c511778f8ee811a3ff6a02e93a32f (patch)
treef7ddf1ec2801e7bc0be59b5994b8cc3d8e6009ed /config/ui.go
parent2e5d9536412ddbb8d1a2bc71efe84040857b30a3 (diff)
downloadaerc-abfb20f1d62c511778f8ee811a3ff6a02e93a32f.tar.gz
config: improve styleset error reporting
Include the styleset filepath and exact statement that caused the error. Remove the "failed to load config: " prefix in the error message. The line is often very long already. Signed-off-by: Robin Jarry <robin@jarry.cc> Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Diffstat (limited to 'config/ui.go')
-rw-r--r--config/ui.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/config/ui.go b/config/ui.go
index e7e96f9f..8b10c8a8 100644
--- a/config/ui.go
+++ b/config/ui.go
@@ -246,8 +246,10 @@ func (ui *UIConfig) loadStyleSet(styleSetDirs []string) error {
ui.style = NewStyleSet()
err := ui.style.LoadStyleSet(ui.StyleSetName, styleSetDirs)
if err != nil {
- return fmt.Errorf("Unable to load %q styleset: %w",
- ui.StyleSetName, err)
+ if ui.style.path == "" {
+ ui.style.path = ui.StyleSetName
+ }
+ return fmt.Errorf("%s: %w", ui.style.path, err)
}
return nil