Skip to content
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

Improve concrete error message #22536

Merged
merged 1 commit into from
Jul 29, 2022

Conversation

damccorm
Copy link
Contributor

@damccorm damccorm commented Jul 29, 2022

In #16776 I introduced CheckConcrete as a better way of passing through an error when a type isn't concrete, but this reference seems to have been missed. This will give the user context on why a type isn't concrete in their error message.

Fixes #18971


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Choose reviewer(s) and mention them in a comment (R: @username).
  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI.

@github-actions github-actions bot added the go label Jul 29, 2022
@damccorm
Copy link
Contributor Author

R: @jrmccluskey - sending another tiny one your way. You can see that the replacement function is virtually the same as the one being replaced, it just provides the extra context:

// IsConcrete returns true iff the given type is a valid "concrete" data type. Such
// data must be fully serializable. Functions and channels are examples of invalid
// types. Aggregate types with no universals are considered concrete here.
func IsConcrete(t reflect.Type) bool {
err := isConcrete(t, make(map[uintptr]bool))
return err == nil
}
// CheckConcrete returns true iff the given type is a valid "concrete" data type and if not,
// returns false along with an error indicating why the type is not concrete. Concrete
// data must be fully serializable. Functions and channels are examples of invalid
// types. Aggregate types with no universals are considered concrete here.
func CheckConcrete(t reflect.Type) (bool, error) {
err := isConcrete(t, make(map[uintptr]bool))
return err == nil, err
}

@github-actions
Copy link
Contributor

Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control

@codecov
Copy link

codecov bot commented Jul 29, 2022

Codecov Report

Merging #22536 (34c08d9) into master (12088cb) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master   #22536   +/-   ##
=======================================
  Coverage   74.17%   74.17%           
=======================================
  Files         706      706           
  Lines       93229    93229           
=======================================
  Hits        69148    69148           
  Misses      22813    22813           
  Partials     1268     1268           
Flag Coverage Δ
go 51.49% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sdks/go/pkg/beam/validate.go 42.10% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us.

Copy link
Contributor

@jrmccluskey jrmccluskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good change!

@damccorm damccorm merged commit e5e3cb2 into apache:master Jul 29, 2022
@damccorm damccorm deleted the users/damccorm/concreteError branch July 29, 2022 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error message for golang non-concrete types
2 participants