adding error management for file writer

This commit is contained in:
christalib 2020-01-12 19:19:21 +01:00
parent 3bc025db78
commit 8f312ce894

View file

@ -90,8 +90,11 @@ func saveData(word string, keysPressed []utils.InputEvent) {
nodeBytes, err := json.Marshal(nodeDatas)
edgeBytes, err := json.Marshal(edgeDatas)
ioutil.WriteFile("nodes.json", nodeBytes, 0644)
ioutil.WriteFile("edges.json", edgeBytes, 0644)
err = ioutil.WriteFile("nodes.json", nodeBytes, 0644)
err = ioutil.WriteFile("edges.json", edgeBytes, 0644)
if err != nil {
logrus.Error(err)
}
}