[ 
https://issues.apache.org/jira/browse/BEAM-3878?focusedWorklogId=145509&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-145509
 ]

ASF GitHub Bot logged work on BEAM-3878:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Sep/18 22:26
            Start Date: 18/Sep/18 22:26
    Worklog Time Spent: 10m 
      Work Description: lostluck commented on a change in pull request #6156: 
[BEAM-3878] Improve error reporting in calls.go
URL: https://github.com/apache/beam/pull/6156#discussion_r218615114
 
 

 ##########
 File path: sdks/go/pkg/beam/core/util/reflectx/calls.tmpl
 ##########
 @@ -57,7 +60,9 @@ func (c *shimFunc{{$in}}x{{$out}}) 
Call{{$in}}x{{$out}}({{mkargs $in "arg%v" "in
 
 func ToFunc{{$in}}x{{$out}}(c Func) Func{{$in}}x{{$out}} {
     if c.Type().NumIn() != {{$in}} || c.Type().NumOut() != {{$out}} {
-        panic("incompatible func type")
+        panic(fmt.Sprintf("incompatible func type, expected function of 
{{$in}} " +
+       "inputs & {{$out}} outputs and instead received a function of %d inputs 
and %d" +
 
 Review comment:
   +1 to this being a good change, and I like henning's suggestion.
   I agree that we should also include the type signature of the failing 
function since it'll help narrow down where something went wrong if the stack 
trace gets swallowed.
   
   %v and passing in c.Type() will accomplish that.
   
   Maybe:
   
   panic(fmt.Sprintf("incompatible func type: %v has %d %d inputs and %d 
outputs, " +    " want function of {{$in}} inputs & {{$out}} outputs", 
c.Type(), c.Type().NumIn(), c.Type().NumOut()))

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 145509)
    Time Spent: 1h  (was: 50m)

> Improve error reporting in calls.go
> -----------------------------------
>
>                 Key: BEAM-3878
>                 URL: https://issues.apache.org/jira/browse/BEAM-3878
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-go
>            Reporter: Bill Neubauer
>            Priority: Minor
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> The error messages generated in calls.go are not as helpful as they could be.
> Instead of simply reporting "incompatible func type" it would be great if 
> they reported the topology of the actual function supplied versus what is 
> expected. That would make debugging a lot easier.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to