Skip to content

Commit

Permalink
Merge pull request #1629 from jinlinGuan/issue-1520
Browse files Browse the repository at this point in the history
fix: Change status code to 400 for write commands with invalid values
  • Loading branch information
cloudxxx8 authored Oct 2, 2024
2 parents 0f2c62f + 44ddd41 commit 63adea8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/application/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ func writeDeviceResource(device models.Device, resourceName string, attributes s
// create CommandValue
cv, edgexErr := createCommandValueFromDeviceResource(dr, v)
if edgexErr != nil {
return nil, errors.NewCommonEdgeX(errors.Kind(edgexErr), "failed to create CommandValue", edgexErr)
return nil, errors.NewCommonEdgeX(errors.KindContractInvalid, "failed to create CommandValue", edgexErr)
}

// prepare CommandRequest
Expand Down Expand Up @@ -385,7 +385,7 @@ func writeDeviceCommand(device models.Device, commandName string, attributes str
if err == nil {
cvs = append(cvs, cv)
} else {
return nil, errors.NewCommonEdgeX(errors.Kind(err), "failed to create CommandValue", err)
return nil, errors.NewCommonEdgeX(errors.KindContractInvalid, "failed to create CommandValue", err)
}
}

Expand Down

0 comments on commit 63adea8

Please sign in to comment.