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 error message for macro argument mismatch #8701

Closed
mlubin opened this issue Oct 16, 2014 · 3 comments
Closed

Improve error message for macro argument mismatch #8701

mlubin opened this issue Oct 16, 2014 · 3 comments
Labels
domain:error handling Handling of exceptions by Julia or the user

Comments

@mlubin
Copy link
Member

mlubin commented Oct 16, 2014

julia> macro m(x)
       x
       end

julia> @m(1,2)
ERROR: wrong number of arguments

It would be great to include the corresponding macro name in the error message. I traced the message to codegen.cpp, but I'm not familiar enough with the code to easily make this change.

@mlubin
Copy link
Member Author

mlubin commented Nov 19, 2014

Any hope for fixing this? Our only workaround in JuMP is to make all macros varargs, which is nasty.

@ihnorton
Copy link
Member

Leaving someone (possibly future-me) some breadcrumbs here:

  • corresponding macro name in the error message could be solved by appending the macro name to the ErrorException error message in the catch block in fl_invoke_julia_macro. I'm not really sure how to do that safely though, because the message is not guaranteed to be an ASCIIString.
  • also noting that we already emit debug info just fine (look at gdblookup for frame 2 after breaking in jl_throw with the example above). the problem is that we don't generate the backtrace right away because we have to return through flisp before actually throwing.

JeffBezanson added a commit that referenced this issue Jan 4, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
JeffBezanson added a commit that referenced this issue Jan 5, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
JeffBezanson added a commit that referenced this issue Jan 5, 2016
fix #9627, fix #8846, fix #8701
helps #3377, but additional work is needed there
@JeffBezanson
Copy link
Sponsor Member

Fixed by #14563.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:error handling Handling of exceptions by Julia or the user
Projects
None yet
Development

No branches or pull requests

4 participants