-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
More user-friendly methods not found error messages #10620
Comments
Code smell much? In Matlab I would refactor that into taking one or a handful of structs pronto, in Julia would either a Dict or a composite type make sense for that interface? Not to say the error couldn't be made fancier and count commas for you, but if you're having to count commas that's not a good sign... |
I'm not entirely sure how much clearer we could make such error messages, but @ViralBShah, if you've got ideas on how to display the more clearly, why not make it easier? |
An example suggestion of the output you want to get would be great! It's easier to discuss the details when we have something to look at. |
Of course, such code needs refactoring. Even during such refactoring, it would be useful to have better messages. We already took a step towards this in 0.4 with the "closest candidates", which is not present in 0.3. I can think of two things that could be useful:
For example:
The coloring is already implemented. |
I think that is a good starting point for a up for grabs issue The relevant code is in base/replutil.jl |
I don't see how you can do this generally. How do you distinguish arguments with default parameters / keyword arguments? The no method error messages would become very verbose. |
I am helping someone port their code to julia and found myself wanting better error messages for methods not found. The codebase I am working on is not long, but it is a bit involved, with lots of functions that take 10-20 arguments. It is easy to pass a wrong type for one or more arguments or pass a different number of arguments. It would be nice if the method not found error message could be improved further.
Currently, we already do this. For example:
What would be nice is to also print the number of arguments in the error message and the closest candidate, if the number of arguments is greater than 5 or something.
The text was updated successfully, but these errors were encountered: