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

[Feature Request] Azure.Core provide an API to configure the RequestFailedDetailsParser #47651

Open
chunyu3 opened this issue Dec 24, 2024 · 2 comments
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library.

Comments

@chunyu3
Copy link
Member

chunyu3 commented Dec 24, 2024

In Azure Core, RequestFailedException will not include the response content or headers in the message when the IsError property of the response is false.

- `RequestFailedException` will not include the response content or headers in the message when the `IsError` property of the response is `false`.

We received a request in Language-Dotnet channel, they want to see the error message from RequestFailedException
https://teams.microsoft.com/l/message/19:[email protected]/1734990642330?tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47&groupId=3e17dcb0-4257-4a30-b843-77f47f1d4121&parentMessageId=1734990642330&teamName=Azure%20SDK&channelName=Language%20-%20DotNet&createdTime=1734990642330

Current solution:
we will ask customer to write customized RequestFailedDetailsParser and set it to Pipeline (customize the client constructor and re-build the pipeline with the customized RequestFailedDetailsParser).

Several DPG SDKs have adopt this solution.

Problem:
This is mgmt-plane SDK which use ArmClient which cannot be customized to accept RequestFailedDetailsParser.
And write customized code is heavy for customer.

Possible solution option:
And since more than one service required to retrieve the content of RequestFailedException, Azure.Core may be can provide an API to construct the Pipeline with cutsomized parser (just like pipeline policy) when create client just like pipeline policy

There will be an optional field RequestFailedDetailsParser? RequestFailedDetailsParser in ClientOptions. When build pipeline, it will set the requestFailedDetailsParser to pipeline.

public abstract class ClientOptions
{
    ...
    public RequestFailedDetailsParser ? RequestFailedDetailsParser { get; set; }
  ...
}

When customer want to retrieve content from RequestFailedException, they can write their own RequestFailedDetailsParser and set to ClientOptions when create client.

@jsquire jsquire added the Client This issue points to a problem in the data-plane of the library. label Dec 24, 2024
@jsquire
Copy link
Member

jsquire commented Dec 24, 2024

@chunyu3 : I don't follow the scenario here. We intentionally do not include the content or headers when IsError is not set to avoid leaking potentially sensitive information. Please explain the full end-to-end scenario of the use case and why accessing the raw response is not adequate. Further, please provide details on why ArmClient cannot use the existing Core API to manage the parser.

//cc: @ArthurMa1978, @m-nash

@ArthurMa1978
Copy link
Member

This feature ask is related to #45220 (comment) , if customer want to have the details of the response then they can specify the RequestFailedDetailsParser when constructing the RequestFailedException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure.Core Client This issue points to a problem in the data-plane of the library.
Projects
None yet
Development

No branches or pull requests

3 participants