riteshghorse commented on a change in pull request #15206:
URL: https://github.com/apache/beam/pull/15206#discussion_r675734013



##########
File path: sdks/go/pkg/beam/core/runtime/exec/util.go
##########
@@ -33,13 +34,29 @@ func (g *GenID) New() UnitID {
        return UnitID(g.last)
 }
 
+type doFnError struct {
+       doFn string
+       err  error
+       uid  UnitID
+       pid  string
+}
+
+func (e *doFnError) Error() string {
+       return fmt.Sprintf("DoFn[<%d>;<%s>]<%s> returned error:<%s>", e.uid, 
e.pid, e.doFn, e.err)
+}
+
 // callNoPanic calls the given function and catches any panic.
 func callNoPanic(ctx context.Context, fn func(context.Context) error) (err 
error) {
        defer func() {
                if r := recover(); r != nil {
-                       // Top level error is the panic itself, but also 
include the stack trace as the original error.
-                       // Higher levels can then add appropriate context 
without getting pushed down by the stack trace.
-                       err = errors.SetTopLevelMsgf(errors.Errorf("panic: %v 
%s", r, debug.Stack()), "panic: %v", r)
+                       // Check if the panic value is from a failed DoFn, and 
return it without a pancic trace.
+                       if e, ok := r.(doFnError); ok {

Review comment:
       Yes, I missed this.




-- 
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