Skip to content

Better error messages #3

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

Closed
emosenkis opened this issue Nov 10, 2017 · 3 comments
Closed

Better error messages #3

emosenkis opened this issue Nov 10, 2017 · 3 comments

Comments

@emosenkis
Copy link

To get better error messages that just "not found" you could implement the missing methods but have them take an argument whose name is the error message. It's not pretty, but at least somewhere in the "wrong number of args" error message there would be a hint about the actual issue.

@TedDriggs
Copy link

Another approach would be to implement the methods and mark them deprecated, then panic at runtime. Not great, but it'd at least get a compile-time message in the right place.

@idanarye
Copy link
Owner

idanarye commented Feb 9, 2019

@TedDriggs - your approach won't work, because if two fields are missing I'll have two deprecated build() methods, and the compiler won't allow that.

I don't think @emosenkis' approach will work either, because I'm not using traits here (don't want to force the user to import a preamble for every TypedBuilder struct they use) and having multiple methods with the same name but different signatures on the same struct (not via traits) is method overloading - which Rust does not support.

@idanarye
Copy link
Owner

Done in #30 by @seb-bl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants