Skip to content

Commit 2a82b6c

Browse files
committed
fix error creation
1 parent a2e9e3c commit 2a82b6c

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

diag/diagnostic.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package diag
22

33
import (
4+
"errors"
45
"fmt"
56

67
"github.com/zclconf/go-cty/cty"
@@ -36,7 +37,7 @@ func (d Diagnostic) Validate() error {
3637
return fmt.Errorf("invalid severity: %v", d.Severity)
3738
}
3839
if d.Summary == "" {
39-
return fmt.Errorf("empty detail")
40+
return errors.New("empty detail")
4041
}
4142
return nil
4243
}

helper/schema/resource.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ func (r *Resource) Apply(
382382
diags = append(diags, r.create(ctx, data, meta)...)
383383
} else {
384384
if !r.updateFuncSet() {
385-
return s, append(diags, diag.FromErr(fmt.Errorf("doesn't support update")))
385+
return s, append(diags, diag.Diagnostic{
386+
Severity: diag.Error,
387+
Summary: "doesn't support update",
388+
})
386389
}
387390
diags = append(diags, r.update(ctx, data, meta)...)
388391
}

0 commit comments

Comments
 (0)