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

Exceptions do not have error messages or error type when converting to string #280

Open
3 tasks
lvalerio opened this issue Jun 24, 2021 · 1 comment
Open
3 tasks
Labels

Comments

@lvalerio
Copy link

Environment

  • sdk package version:
    idem-vmc 1 /usr/local/src/ace/idem-vmc
    nsx-vmc-aws-integration-python-sdk 3.0.3.0.0.17723277
    nsx-vmc-policy-python-sdk 3.0.3.0.0.17723277
    pyvmomi 7.0.2
    vapi-client-bindings 3.6.0
    vapi-common-client 2.25.0
    vapi-runtime 2.25.0
    vmc-client-bindings 1.40.0
    vmc-draas-client-bindings 1.17.0
    vSphere-Automation-SDK 1.56.0

  • python version:
    Python 3.7.10

  • vSphere version:
    VMC

  • Operating System/Shell (used to run SDK-based apps):
    Mac

Steps or code snippet to reproduce

Generate any exception with the VMC SDK. For example, deleting an SDDC that is in the process of being created, calling a get on an SDDC that does not exist, etc. When you try to convert the error to a string using the function str() the string you get back loses all information about the error.

Actual behavior

Calling delete on an SDDC that is in the process of being created returns an InvalidRequest which is correct but when we convert the error to a string we get {{messages : [], data : {{}}, error_type : None}}. The same thing happens with numerous other exceptions. However, we you call the to_json() function of the error, you get:

{"messages":[],"data":{"error_code":"skyscraper.sddc.not.ready.for.delete","error_messages":["Sddc is currently not in a state where it can be deleted. Please try once the status is READY or FAILED."],"retryable":false,"status":400,"path":"/vmc/api/orgs/REDACTED/sddcs/REDACTED"}}

Expected behavior

We should be returning an error message and the error type as strings something like {{messages : ['The sddc is not in a state that's valid for deletion'], data : {{}}, error_type : InvalidRequest }}. At the very least we should return the same string we get when we call the to_json() function of the error.

@shwetapurohit
Copy link
Contributor

@lvalerio : I could reproduce the issue, It’s an issue in Python Runtime. I've filed a bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants