Skip to content

Commit

Permalink
fix(labels): correct return statements
Browse files Browse the repository at this point in the history
  • Loading branch information
adutchak committed May 12, 2024
1 parent aa99688 commit f5f38fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func (r *recognizer) processImage(ctx context.Context, sourceBytes []byte) error
labelsOutput, err := r.recognizeClient.DetectLabels(ctx, &detectLabelsInputs)
if err != nil {
log.Error("Error detecting labels", err)
publishMqttMessage(r.mqttClient, r.configuration.MqttTopic, r.configuration.MqttNotRecognizedMessage)
return err
}
if r.configuration.DiscoveryMode {
Expand All @@ -254,16 +255,16 @@ func (r *recognizer) processImage(ctx context.Context, sourceBytes []byte) error
for labelName, threshold := range r.configuration.ConfidencesNotLessThanNormalized {
labelsPassed, err = verifyLabelConfidenceNotLessThan(label, labelName, threshold)
if err != nil {
// No return here, because we want to check all the labels
log.Error(err)
return err
}
}

for labelName, threshold := range r.configuration.ConfidencesNotMoreThanNormalized {
labelsPassed, err = verifyLabelConfidenceNotMoreThan(label, labelName, threshold)
if err != nil {
// No return here, because we want to check all the labels
log.Error(err)
return err
}
}
}
Expand Down

0 comments on commit f5f38fd

Please sign in to comment.