cisco-en-programmability / dnacentersdk

Cisco DNA Center Python SDK
https://dnacentersdk.readthedocs.io/en/latest/
MIT License
70 stars 33 forks source link

Actual error message was not being used in case of exceptions #98

Closed JayaVamsiKrishnaSaiVolla closed 1 year ago

JayaVamsiKrishnaSaiVolla commented 1 year ago

Prerequisites

Describe the bug In case of exceptions occurred from API call, SDK is returning generic error for all exceptions instead of failure error message received from API response.

Expected behavior In place of generic error messages , SDK should return actual error message of failure cause.

LOGS: [400] Bad Request - The request was invalid or cannot be otherwise served. Traceback (most recent call last): File "/ws/sjc-it/jvolla/dnac-auto/tools/SolDubugger/solservices/dnac_module/fabric/dnac_fabric.py", line 264, in add_intf_for_user_device siteNameHierarchy=hierarchy) File "/ws/sjc-it/jvolla/pyats/lib64/python3.6/site-packages/dnacentersdk/api/v2_3_3_0/sda.py", line 1520, in add_port_assignment_for_user_device json=_payload) File "/ws/sjc-it/jvolla/pyats/lib64/python3.6/site-packages/dnacentersdk/restsession.py", line 620, in post json=json, data=data, **kwargs) File "/ws/sjc-it/jvolla/pyats/lib64/python3.6/site-packages/dnacentersdk/restsession.py", line 471, in request check_response_code(response, erc) File "/ws/sjc-it/jvolla/pyats/lib64/python3.6/site-packages/dnacentersdk/utils.py", line 209, in check_response_code raise ApiError(response) dnacentersdk.exceptions.ApiError: [400] Bad Request - The request was invalid or cannot be otherwise served.

Environment (please complete the following information):

fmunozmiranda commented 1 year ago

@JayaVamsiKrishnaSaiVolla For this case, SDK was updated on v2.6.3 to show API message, if you find any another case, please notify us to include it. Verify it and let us know how does it goes.