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

Better error messages for macros #72

Closed
IainNZ opened this issue Nov 25, 2013 · 4 comments
Closed

Better error messages for macros #72

IainNZ opened this issue Nov 25, 2013 · 4 comments
Labels

Comments

@IainNZ
Copy link
Collaborator

IainNZ commented Nov 25, 2013

So

@addConstraint(x <= 5)

is an error because there is no model (even though we could determine it, thats a different issue...)
But, due to Julia's poor line number error printing stuff, if this is in the middle of a largish function it won't tell you where, and won't even tell you what you've done wrong apart from an error about the wrong numbre of arguments.

Suggestion: make @addConstraint(x<=5) a valid macro that just throws an error saying to do it the "right" way.

@mlubin
Copy link
Member

mlubin commented Nov 25, 2013

You can't overload macros based on the number of arguments, so this will make the code messier. Julia really needs to print a better error message in this case.

@IainNZ
Copy link
Collaborator Author

IainNZ commented Nov 25, 2013

Oh really? Darn, thought I was being clever...

@mlubin
Copy link
Member

mlubin commented Oct 19, 2014

Ref JuliaLang/julia#8701

@mlubin
Copy link
Member

mlubin commented Jan 24, 2016

Upstream issue is resolved:

julia> @addNLConstraint(x <= 5)
ERROR: MethodError: `@addNLConstraint` has no method matching @addNLConstraint(::Expr)
Closest candidates are:
  @addNLConstraint(::ANY, ::ANY, ::Any...)

Not super user friendly but at least gives the name of the macro and a backtrace.

@mlubin mlubin closed this as completed Jan 24, 2016
blegat pushed a commit that referenced this issue Oct 16, 2018
The status code for CPX_STAT_ABORT_OBJ_LIM(Aborted due to an objective limit) is mapped to 11 instead of 12.
closes #72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants