Browse Source

return error if the tag is not found

The previous routine cause panic if the tag is not found. Thanks for report from mzz
Shelikhoo 4 years ago
parent
commit
2fcddf1966
1 changed files with 5 additions and 1 deletions
  1. 5 1
      app/observatory/command/command.go

+ 5 - 1
app/observatory/command/command.go

@@ -34,7 +34,11 @@ func (s *service) GetOutboundStatus(ctx context.Context, request *GetOutboundSta
 		}
 		result = observeResult
 	} else {
-		observeResult, err := common.Must2(s.observatory.(features.TaggedFeatures).GetFeaturesByTag(request.Tag)).(extension.Observatory).GetObservation(ctx)
+		fet, err := s.observatory.(features.TaggedFeatures).GetFeaturesByTag(request.Tag)
+		if err != nil {
+			return nil, newError("cannot get tagged observatory").Base(err)
+		}
+		observeResult, err := fet.(extension.Observatory).GetObservation(ctx)
 		if err != nil {
 			return nil, newError("cannot get observation").Base(err)
 		}