diff --git a/config/config.go b/config/config.go index 9636c38d..24288670 100644 --- a/config/config.go +++ b/config/config.go @@ -663,7 +663,7 @@ func LoadConfig() (*Config, error) { } return &config, nil } - return nil, err + return nil, fmt.Errorf("could not parse config file %s: %w", path, err) } config.DisableImages = raw.DisableImages diff --git a/config/keybinds.go b/config/keybinds.go index f7856522..727bf777 100644 --- a/config/keybinds.go +++ b/config/keybinds.go @@ -3,6 +3,7 @@ package config import ( _ "embed" "encoding/json" + "log" keybind "github.com/floatpane/go-keybind" ) @@ -87,7 +88,9 @@ type DraftsKeys struct { func defaultKeybinds() KeybindsConfig { var kb KeybindsConfig if err := json.Unmarshal(defaultKeybindsJSON, &kb); err != nil { - panic("matcha: malformed default_keybinds.json: " + err.Error()) + // This should never happen — the embedded JSON is compiled into the + // binary. If it does, return empty keybinds rather than panicking. + log.Printf("matcha: malformed default_keybinds.json (using empty keybinds): %v", err) } return kb }