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

Forward MatlabInterperterError to the user #118

Merged
merged 1 commit into from
Jan 28, 2015

Conversation

jakirkham
Copy link
Contributor

This PR is to address #117. It ensures that MatlabInterperterError is re-raised so the user can get some feedback as to what caused the error if there was one. If anyone wants to improve on it, feel free.

…ke sure it gets raised instead of generic RuntimeError so the user gets some feedback. Fixes arokem#117.
@isbadawi isbadawi merged commit 08cd855 into arokem:master Jan 28, 2015
@isbadawi
Copy link
Collaborator

Looks good. There seemed to be a lot of opportunity for cleanup in the surrounding code so I followed it up with another commit. Let me know if you run into issues!

@jakirkham
Copy link
Contributor Author

No problems here.

@jakirkham jakirkham deleted the matlab_error_messages branch January 28, 2015 18:22
@@ -211,6 +211,8 @@ def matlab(self, line, cell=None, local_ns=None):
else:
e_s = "There was an error running the code:\n %s"%code
result_dict = self.eval(code)
except MatlabInterperterError:
raise
except:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would happen with this second exception? Should we remove this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough about your code to say. I'm guessing that some other kind of exception is raised when a MATLAB session cannot be found and it would be caught here.

However, I agree that it should be removed if possible, it's not great that it may catch and hide other exceptions at this point to. Do you know what exception gets raised when the interpreter can't be found? If there isn't one, maybe one can be added and this problem could be avoided.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that @isbadawi's subsequent commit (944cf22) actually addresses this well. Sorry for the noise.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We came across this before in #79, and we couldn't figure out what exception was meant to go there. It might make sense to just capture all exceptions from zmq (e.g. wrapped in MatlabCommunicationError or something like that) and catch just those here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and we should also wrap OSErrors from subprocess.Popen as well. That's the part that spawns the matlab process.

@jakirkham
Copy link
Contributor Author

+1 @isbadawi

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

Successfully merging this pull request may close these issues.

3 participants