From 8fef749fd5f63446cc3bd3ed078c88ecc66ce5be Mon Sep 17 00:00:00 2001 From: Edru2 <60551052+Edru2@users.noreply.github.com> Date: Wed, 13 Mar 2024 19:05:19 +0100 Subject: [PATCH] add missing errorhandling to functions --- KeyFunctions.go | 3 +++ ScriptFunctions.go | 3 +++ TimerFunctions.go | 3 +++ TriggerFunctions.go | 3 +++ 4 files changed, 12 insertions(+) diff --git a/KeyFunctions.go b/KeyFunctions.go index 3b03ff1..2f06eb1 100644 --- a/KeyFunctions.go +++ b/KeyFunctions.go @@ -35,6 +35,9 @@ func handleKeys(keys *[]Key, parentDir string) { jsonFilePath := filepath.Join(parentDir, "keys.json") jsonData, err := json.MarshalIndent(jsonFile, "", " ") + if err != nil { + panic(err) + } err = os.WriteFile(jsonFilePath, jsonData, 0644) if err != nil { panic(err) diff --git a/ScriptFunctions.go b/ScriptFunctions.go index 50de95c..bf6ef76 100644 --- a/ScriptFunctions.go +++ b/ScriptFunctions.go @@ -32,6 +32,9 @@ func handleScripts(scripts *[]Script, parentDir string) { jsonFilePath := filepath.Join(parentDir, "scripts.json") jsonData, err := json.MarshalIndent(jsonFile, "", " ") + if err != nil { + panic(err) + } err = os.WriteFile(jsonFilePath, jsonData, 0644) if err != nil { panic(err) diff --git a/TimerFunctions.go b/TimerFunctions.go index 88e0e33..95f7c09 100644 --- a/TimerFunctions.go +++ b/TimerFunctions.go @@ -35,6 +35,9 @@ func handleTimers(timers *[]Timer, parentDir string) { jsonFilePath := filepath.Join(parentDir, "timers.json") jsonData, err := json.MarshalIndent(jsonFile, "", " ") + if err != nil { + panic(err) + } err = os.WriteFile(jsonFilePath, jsonData, 0644) if err != nil { panic(err) diff --git a/TriggerFunctions.go b/TriggerFunctions.go index 7940bd4..6630506 100644 --- a/TriggerFunctions.go +++ b/TriggerFunctions.go @@ -86,6 +86,9 @@ func handleTriggers(triggers *[]Trigger, parentDir string) { jsonFilePath := filepath.Join(parentDir, "triggers.json") jsonData, err := json.MarshalIndent(jsonFile, "", " ") + if err != nil { + panic(err) + } err = os.WriteFile(jsonFilePath, jsonData, 0644) if err != nil { panic(err)