kiota icon indicating copy to clipboard operation
kiota copied to clipboard

Override ApiException.Message getter to include ResponseStatusCode

Open koen-lee opened this issue 3 months ago • 9 comments

See #4349; the default exception details are not very helpful. This PR intends to add the ResponseStatusCode, property of the base ApiException, to the message when no primary message extension is used.

It's not great, the suggestion from the above issue to add the description from the spec is better, but this is (hopefully) an incremental improvement, relatively low impact, and may serve as an example for future improvements by pointing at the relevant code.

Considerations:

  • it interpolates a new string for every call, but there's no easy way around that since ResponseStatusCode is mutable.
  • this could also be implemented in ApiException, but I think that would have higher impact and is less future proof: it's not in the path of fixing #4349.

koen-lee avatar Sep 24 '25 10:09 koen-lee