I think it would make sense that in the case that there is a known Error response type for a given status code, then the response should be parsed (which in the HttpClientRequestAdapter it already is) and added to the ApiException so that is accessible to the calling code handling the exception.
API Changes
To facilitate this, a new property would need to be added to ApiException:
public class ApiException : Exception
{
public ApiException() : base()
public ApiException(string message) : base(message)
public ApiException(string message, Exception innerException) : base(message, innerException)
public int ResponseStatusCode { get; set; }
public IDictionary<string, IEnumerable<string>> ResponseHeaders { get; set; }
+ public object? ResponseObject { get; set; }
}
I would then expect the type of the ResponseObject to be disambiguated in calling code.
This is related to a suggestion I made here: https://github.com/microsoft/kiota-http-dotnet/issues/188
Description
I think it would make sense that in the case that there is a known Error response type for a given status code, then the response should be parsed (which in the
HttpClientRequestAdapter
it already is) and added to theApiException
so that is accessible to the calling code handling the exception.API Changes
To facilitate this, a new property would need to be added to
ApiException
:I would then expect the type of the
ResponseObject
to be disambiguated in calling code.