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

Properly expose SCIP error codes to users. #78

Open
rschwarz opened this issue Jan 4, 2019 · 6 comments
Open

Properly expose SCIP error codes to users. #78

rschwarz opened this issue Jan 4, 2019 · 6 comments
Milestone

Comments

@rschwarz
Copy link
Collaborator

rschwarz commented Jan 4, 2019

This applies to the rewrite (after #76 is merged).

Currently, the simple @SC macro is used everywhere, where on would use SCIP_CALL in C.
It only does an @assert to check that the return code is SCIP_OKAY.

It would be better to throw a custom exception, also explaining what happened.

Not sure if we can actually show the full stacktrace (including the SCIP calls). I believe this requires compiling SCIP in debug mode?

cc @fserra

@rschwarz
Copy link
Collaborator Author

rschwarz commented Jan 4, 2019

See also MathOptInterface.jl/error.jl

@fserra
Copy link
Collaborator

fserra commented Jan 5, 2019

the errors appear also in opt mode

@rschwarz rschwarz added this to the 0.7 milestone Jan 20, 2019
@rschwarz rschwarz modified the milestones: 0.7, 1.0 Mar 4, 2019
@matbesancon
Copy link
Member

Not sure if we can actually show the full stacktrace (including the SCIP calls). I believe this requires compiling SCIP in debug mode?

I'm not sure we will get a full stacktrace anyway if there is no error on the SCIP side, just a return code. We could just send a warning when the return code is not SCIP_OKAY, but I'm not sure there are many cases where a different retcode should not result in an error

@rschwarz
Copy link
Collaborator Author

I'm not sure what you mean with:

if there is no error on the SCIP side, just a return code

If I remember correctly, SCIP only uses return codes to do error handling, but the SCIP_CALL macro will also print a corresponding line for each layer of the stack. A return code different from SCIP_OKAY would then always signal an error.

I guess in the context of SCIP.jl, the most likely case would be an invalid stage. I don't think that these can be "dealt with" completely in the wrapper, so the user should at least get meaningful information for what happened and how to resolve the issue.

@matbesancon
Copy link
Member

OK I see. So the goal would be to print the code before throwing an error instead of the assert in the macro?

@rschwarz
Copy link
Collaborator Author

For example, or even have SCIP print its internal stack trace. Not sure whether that would be helpful to the typical user of SCIP.jl, but it would definitely be convenient for users with SCIP experience.

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