-
Notifications
You must be signed in to change notification settings - Fork 4.5k
[BEAM-3878] Improve error reporting in calls.go #6156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BEAM-3878] Improve error reporting in calls.go #6156
Conversation
|
cc @herohde thanks for your help with finding the specialize thing, do you have cycles to review this change? |
| 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" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change.
Small suggestion: maybe include the full function type as well? Btw, the usual way of writing these error messages in the opinionated language of Go is a terse got-then-want style: "blah: %v, want %v".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+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()))
|
@herohde friendly ping! |
|
What is the status of this PR? |
|
This PR was last updated more than 2 months ago. We should either merge or close it soon. |
|
This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@beam.apache.org list. Thank you for your contributions. |
|
This pull request has been closed due to lack of activity. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time. |
Improve error reporting in calls.go by outputing the expected and provided number of arguments when a mismatch occurs.
Follow this checklist to help us incorporate your contribution quickly and easily:
[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue.It will help us expedite review of your Pull Request if you tag someone (e.g.
@username) to look at it.Post-Commit Tests Status (on master branch)