-
Notifications
You must be signed in to change notification settings - Fork 767
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
raise exceptions #78
Comments
+1 on this. |
Yes - +1. |
Is this still not done? |
I'm not sure how it would work for that example that you have. So are you suggesting that every time a remote method on a managed object is called it checks for an "error" property and raising an exception? Export/Import VM/vApp seems to be quite an exceptional part of the VIM API as it is relying on an out-of-band method to download/upload files. It even lets you pass an exception to the server with abort(MethodFault). |
Exactly: That's the pythonese way to do it. As it is today, it's forcing Python developers into writing code in a very non-pythonese way. That's a serious usability degradation. |
At present actions that seem like they would throw exceptions do not. Instead the error is transmitted as part of a data object and the programmer is expected to check for an exception before proceeding.
Example:
... this is currently anticipated behavior, so most programmers who have been using the lib for a number of years will have code built to handle this kind of check. The problem is new programmers will expect the method to actually raise an exception (the method's documentation states that it raises exceptions when in pyVmomi it never does).
Enhancement
When an exception occurs on a remote method, raise the exception as if it occurred in Python. This is the most pythonic way to handle raising an exception.
The text was updated successfully, but these errors were encountered: