Skip to content

Commit a6ddae9

Browse files
committed
feat(edit): introduce edit error
1 parent bbb52bf commit a6ddae9

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

internal/agent/edit.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func (a *Agent) editAgent(service string, data *EditData) error {
2727

2828
ctx, client, err := grpc.NewClient(ctx, service, api.NewAgentServiceClient)
2929
if err != nil {
30-
return &RegisterAgentError{Message: err.Error(), Reason: ""}
30+
return &EditAgentError{Message: err.Error(), Reason: ""}
3131
}
3232
defer func() {
3333
_ = client.Close()
@@ -42,7 +42,7 @@ func (a *Agent) editAgent(service string, data *EditData) error {
4242
Labels: data.Labels,
4343
})
4444
if err != nil {
45-
return &RegisterAgentError{Message: err.Error(), Reason: ""}
45+
return &EditAgentError{Message: err.Error(), Reason: ""}
4646
}
4747

4848
return nil

internal/agent/errors.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ func (e *DescribeAgentError) Error() string {
7878
return strings.TrimSpace(fmt.Sprintf("Failed to get agent description: %s %s", e.Message, e.Reason))
7979
}
8080

81+
type EditAgentError struct {
82+
Message string
83+
Reason string
84+
}
85+
86+
func (e *EditAgentError) Error() string {
87+
return strings.TrimSpace(fmt.Sprintf("Failed to edit agent: %s %s", e.Message, e.Reason))
88+
}
89+
8190
func convertError(err error, to any) error {
8291
if err == nil {
8392
return nil

0 commit comments

Comments
 (0)