cisco-en-programmability/dnacentersdk

Actual error message was not being used in case of exceptions

Closed this issue · 1 comments

Prerequisites

  • Have you tested the operation in the API directly?
  • Do you have the latest SDK version?
  • Review the compatibility matrix before opening an issue.

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):

  • Cisco DNA Center Version and patch: 2.3.6.0
  • Python version:3.6
  • SDK version:2.3.3
  • OS Version:

@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.