Skip to content

Commit

Permalink
minor error handling fixes (apache#25555)
Browse files Browse the repository at this point in the history
  • Loading branch information
lostluck authored and ruslan-ikhsan committed Mar 10, 2023
1 parent 54c720c commit a1ee78d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions sdks/go/pkg/beam/core/graph/fn.go
Original file line number Diff line number Diff line change
Expand Up @@ -1099,13 +1099,13 @@ func validateSdfElementT(fn *Fn, name string, method *funcx.Fn, num int, startIn

for i := 0; i < num; i++ {
idx := i + startIndex
if method.Param[idx].T != processFn.Param[pos+i].T {
if got, want := method.Param[i+startIndex].T, processFn.Param[pos+i].T; got != want {
err := errors.Errorf("mismatched element type in method %v, param %v. got: %v, want: %v",
name, idx, method.Param[idx].T, processFn.Param[pos+i].T)
name, idx, got, want)
return errors.SetTopLevelMsgf(err, "Mismatched element type in method %v, "+
"parameter at index %v. Got: %v, Want: %v (from method %v). "+
"Ensure that element parameters in SDF methods have consistent types with element parameters in %v.",
name, idx, method.Param[idx].T, processFn.Param[pos+i].T, processElementName, processElementName)
name, idx, got, want, processElementName, processElementName)
}
}
return nil
Expand Down Expand Up @@ -1250,7 +1250,7 @@ func validateStatefulWatermarkSig(fn *Fn, numMainIn int) error {
"Ensure that all restrictions in an SDF are the same type.",
initialWatermarkEstimatorStateName, 1, method.Param[1].T, restT, createTrackerName)
}
if err := validateSdfElementT(fn, restrictionSizeName, method, numMainIn, 2); err != nil {
if err := validateSdfElementT(fn, initialWatermarkEstimatorStateName, method, numMainIn, 2); err != nil {
return err
}

Expand Down
2 changes: 1 addition & 1 deletion sdks/go/pkg/beam/core/runtime/exec/datasink.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (n *DataSink) ProcessElement(ctx context.Context, value *FullValue, values
return err
}
if err := n.enc.Encode(value, &b); err != nil {
return errors.WithContextf(err, "encoding element %v with coder %v", value, n.enc)
return errors.WithContextf(err, "encoding element %v with coder %v", value, n.Coder)
}
byteCount, err := n.w.Write(b.Bytes())
if err != nil {
Expand Down

0 comments on commit a1ee78d

Please sign in to comment.