Hii, I am Darshan Hiranandani, I am looking to improve my approach to handling errors and exceptions when working with APIs. Could anyone share their insights or best practices for effectively managing and responding to errors returned by APIs? Whether it is dealing with status codes, parsing error messages, or implementing retry logic, I'd love to hear your experiences and recommendations. Thank you in advance for your valuable input!
You could create a common library for the API you specified. I am using Python, so probably I will work utilize the urllib3 module. python - urllib3 how to find code and message of Http error - Stack Overflow
if you want to implemen retry logic you could use while == True, if its pass the error break the it with False. If certain try still error you could use sys.exit()
Hope it helps you
Cheers