Azure / azure-sdk-for-python

This repository is for active development of the Azure SDK for Python. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/python/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-python.
MIT License
4.54k stars 2.77k forks source link

Improve Error Messaging for Unsupported Zones in SDK #36841

Open shashankqv opened 1 month ago

shashankqv commented 1 month ago

When using the Azure Document Intelligence Python SDK, I encountered a ResourceNotFoundError with a 404 status code. After spending a full day debugging, I found out that the error was due to the Zone I selected when creating the Document Intelligence resource being unsupported. However, the error message did not explicitly mention that the issue was related to the unsupported Zone, leading to unnecessary time spent troubleshooting.

I would like the exception message to explicitly indicate when a Zone or Location selected for the Document Intelligence resource is not supported. This could save developers significant time by providing more specific guidance on why the resource is not found.

An alternative could be to provide a warning or validation during the resource creation process in the Azure Portal if a user selects a Zone or Location that is not supported by the Document Intelligence service.

context

Created a document intelligence resource on Azure portal & got 2 Keys, Location/Region & an endpoint. Documentation URL - https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/quickstarts/get-started-sdks-rest-api?view=doc-intel-4.0.0&pivots=programming-language-python#prebuilt-model

Current Error message Structure :

Screenshot 2024-08-11 at 1 22 41 AM
azure.core.exceptions.ResourceNotFoundError: (404) Resource not found
Code: 404
Message: Resource not found
python-BaseException

Proposed Error message Structure :

azure.core.exceptions.ResourceNotFoundError: (404) Resource not found 
Code: 404
Message: Resource not found (Zone not supported as of now, consider recreating document intelligent resource with the supported Zones)
python-BaseException

Explicitly stating this in the error message would improve the developer experience.

kashifkhan commented 1 month ago

Thank you for the feedback @shashankqv . We will investigate and get back to you asap.

github-actions[bot] commented 1 month ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @bojunehsu @vkurpad.

shashankqv commented 3 weeks ago

Hi All - Let me know if you'd need something else on this from my end. Looking forward to see some progress/ update on this.

YalinLi0312 commented 1 week ago

Hi @shashankqv , the error is from REST API, nothing we can change in SDK except manually change the error info in our side. Add @bojunehsu for service awareness.

shashankqv commented 1 week ago

Thanks for your response @YalinLi0312 .

Hi @bojunehsu - Could you please review this request and let us know if something can done at service end?