From bddbee4158bef06918e713d965bd962467bde426 Mon Sep 17 00:00:00 2001 From: Chris Lane Date: Wed, 11 Mar 2020 18:51:06 -0400 Subject: [PATCH] fix(logging): improve sheets load logging Improve logging in `sheets.Load`: - Make error verbage consistant with verbiage elsewhere - Add more information to logging statements --- internal/sheets/load.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/internal/sheets/load.go b/internal/sheets/load.go index 1ad7877..9ea85fb 100644 --- a/internal/sheets/load.go +++ b/internal/sheets/load.go @@ -33,7 +33,7 @@ func Load(cheatpaths []cp.Cheatpath) ([]map[string]sheet.Sheet, error) { // fail if an error occurred while walking the directory if err != nil { - return fmt.Errorf("error walking path: %v", err) + return fmt.Errorf("failed to walk path: %v", err) } // don't register directories as cheatsheets @@ -61,7 +61,12 @@ func Load(cheatpaths []cp.Cheatpath) ([]map[string]sheet.Sheet, error) { // parse the cheatsheet file into a `sheet` struct s, err := sheet.New(title, path, cheatpath.Tags, cheatpath.ReadOnly) if err != nil { - return fmt.Errorf("could not create sheet: %v", err) + return fmt.Errorf( + "failed to load sheet: %s, path: %s, err: %v", + title, + path, + err, + ) } // register the cheatsheet on its cheatpath, keyed by its title