Skip to content

Commit 9a943f1

Browse files
committed
replace fmt.Sprintf(err) by err.Error()
1 parent c10d480 commit 9a943f1

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

internal/services/instance/action_create_snapshot.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func (c *CreateSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
162162
if err != nil {
163163
resp.Diagnostics.AddError(
164164
"error creating instance snapshot",
165-
fmt.Sprintf("%s", err))
165+
err.Error())
166166

167167
return
168168
}
@@ -175,7 +175,7 @@ func (c *CreateSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
175175
if errWait != nil {
176176
resp.Diagnostics.AddError(
177177
"error waiting for instance snapshot",
178-
fmt.Sprintf("%s", err))
178+
err.Error())
179179
}
180180
}
181181
case instance.VolumeVolumeTypeSbsVolume:
@@ -205,7 +205,7 @@ func (c *CreateSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
205205
if err != nil {
206206
resp.Diagnostics.AddError(
207207
"error creating block snapshot",
208-
fmt.Sprintf("%s", err))
208+
err.Error())
209209

210210
return
211211
}
@@ -218,7 +218,7 @@ func (c *CreateSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
218218
if errWait != nil {
219219
resp.Diagnostics.AddError(
220220
"error waiting for block snapshot",
221-
fmt.Sprintf("%s", err))
221+
err.Error())
222222
}
223223
}
224224
case instance.VolumeVolumeTypeScratch:

internal/services/instance/action_export_snapshot.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ func (e *ExportSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
150150
if err != nil {
151151
resp.Diagnostics.AddError(
152152
"error exporting instance snapshot",
153-
fmt.Sprintf("%s", err))
153+
err.Error())
154154

155155
return
156156
}
@@ -163,7 +163,7 @@ func (e *ExportSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
163163
if err != nil {
164164
resp.Diagnostics.AddError(
165165
"error waiting for instance snapshot",
166-
fmt.Sprintf("%s", err))
166+
err.Error())
167167
}
168168
}
169169
case instance.VolumeVolumeTypeSbsSnapshot:
@@ -183,7 +183,7 @@ func (e *ExportSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
183183
if err != nil {
184184
resp.Diagnostics.AddError(
185185
"error exporting block snapshot",
186-
fmt.Sprintf("%s", err))
186+
err.Error())
187187

188188
return
189189
}
@@ -196,7 +196,7 @@ func (e *ExportSnapshot) Invoke(ctx context.Context, req action.InvokeRequest, r
196196
if err != nil {
197197
resp.Diagnostics.AddError(
198198
"error waiting for block snapshot",
199-
fmt.Sprintf("%s", err))
199+
err.Error())
200200
}
201201
}
202202
default:

internal/services/instance/action_server_action.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,20 +136,20 @@ func (a *ServerAction) Invoke(ctx context.Context, req action.InvokeRequest, res
136136
if err != nil {
137137
resp.Diagnostics.AddError(
138138
"error in server action",
139-
fmt.Sprintf("%s", err))
139+
err.Error())
140140

141141
return
142142
}
143143

144144
if data.Wait.ValueBool() {
145-
_, errWait := a.instanceAPI.WaitForServer(&instance.WaitForServerRequest{
145+
server, err := a.instanceAPI.WaitForServer(&instance.WaitForServerRequest{
146146
ServerID: serverID,
147147
Zone: scw.Zone(zone),
148148
}, scw.WithContext(ctx))
149-
if errWait != nil && data.Action.ValueString() != instance.ServerActionTerminate.String() {
149+
if err != nil && data.Action.ValueString() != instance.ServerActionTerminate.String() {
150150
resp.Diagnostics.AddError(
151-
"error in wait server",
152-
fmt.Sprintf("%s", err))
151+
"error waiting for server"+serverID,
152+
err.Error())
153153
}
154154
}
155155
}

0 commit comments

Comments
 (0)