Skip to content

Commit 1f40444

Browse files
pieternnfx
authored andcommitted
Log error instead of panicking in DiffSuppressFunc
1 parent 3b0d82a commit 1f40444

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sqlanalytics/resource_visualization.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"context"
66
"encoding/json"
7+
"log"
78
"strconv"
89
"strings"
910

@@ -174,11 +175,13 @@ func ResourceVisualization() *schema.Resource {
174175
m["options"].DiffSuppressFunc = func(_, old, new string, d *schema.ResourceData) bool {
175176
oldp, err := jsonRemarshal([]byte(old))
176177
if err != nil {
177-
panic(err)
178+
log.Printf("[WARN] Unable to remarshal value %#v", old)
179+
return false
178180
}
179181
newp, err := jsonRemarshal([]byte(new))
180182
if err != nil {
181-
panic(err)
183+
log.Printf("[WARN] Unable to remarshal value %#v", new)
184+
return false
182185
}
183186
return bytes.Equal(oldp, newp)
184187
}

0 commit comments

Comments
 (0)