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

[corehttp] HttpResponseError lacks kwargs signature model compared with same class of azure-core #38956

Open
msyyc opened this issue Dec 20, 2024 · 3 comments
Assignees

Comments

@msyyc
Copy link
Member

msyyc commented Dec 20, 2024

HttpResponse lacks kwargs signature model compared with same class of azure-core

  • corehttp:
    Image

  • azure-core:
    Image

@github-actions github-actions bot added Azure.Core Client This issue points to a problem in the data-plane of the library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Dec 20, 2024
Copy link

@kashifkhan @xiangyan99

Copy link

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@msyyc msyyc added Core.Http and removed Client This issue points to a problem in the data-plane of the library. Azure.Core needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Dec 20, 2024
@msyyc
Copy link
Member Author

msyyc commented Dec 20, 2024

Not sure whether it is by design, but I think model signature is important. For example, when Typespec defines customized error like:

@error
model PetStoreError {
  code: int32;
  message: string;
}

(typepsec link)
The generated SDK will try to deserialize the response body with PetStoreError when error occurs then set it in model signature

            map_error(status_code=response.status_code, response=response, error_map=error_map)
            error = _failsafe_deserialize(_models.PetStoreError, response.json())
            raise HttpResponseError(response=response, model=error)

(generated SDK link)

so that SDK users could access the user-defined error model easily like:

try:
   client.op(...)
except HttpResponseError as err:
    print(err.model.code)
    print(err.model.message)

However, if corehttp doesn't have model signature for HttpResponseError, there is no other way to set the deserialized model for SDK users.

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

No branches or pull requests

3 participants