lostluck commented on a change in pull request #15175:
URL: https://github.com/apache/beam/pull/15175#discussion_r671346363



##########
File path: sdks/go/pkg/beam/testing/passert/floats.go
##########
@@ -70,3 +122,13 @@ func (f *boundsFn) ProcessElement(_ []byte, col 
func(*beam.T) bool) error {
        }
        return errors.New(strings.Join(errorStrings, "\n"))
 }
+
+func toFloat(input beam.T) float64 {
+       return 
reflect.ValueOf(input.(interface{})).Convert(reflectx.Float64).Interface().(float64)
+}
+
+func validateNonComplexNumber(t reflect.Type) {
+       if !reflectx.IsNumber(t) || reflectx.IsComplex(t) {
+               panic(fmt.Sprintf("type must be a non-complex number: %v", t))

Review comment:
       In this case, return an error, so the caller can add additional 
information to the error.  "the observed PCollection elements have an 
incompatible type" or "the expected PCollection elements have an incompatible 
type" .
   
   Good error messages make good frameworks.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to