1

I am using Dapr in a .Net microservices environment to communicate between different services. I have run into a situation where the called service is throwing an exception (could be for any reason) but the calling service only sees it returned as a Dapr InvocationException which seems to hide the original exception.

enter image description here

I can get the request body by calling Response.Content.ReadAsStringAsync which does return the original exception message, but also the entire stack trace and headers. enter image description here Is there any way to get the original exception object (ie. InvalidOperationException, ArgumentException etc) after catching the InvocationException?

Steve
  • 9,335
  • 10
  • 49
  • 81
  • `also the entire stack trace and headers.` that *is* the actual exception, and a lot more useful than just the message. Especially in this cases which clearly tells you the details are in the inner exception – Panagiotis Kanavos Aug 25 '23 at 13:13
  • In fact, if you only post the message in an SO question people will tell you to post the full text instead, because that shows not only any inner exceptions but which calls were made that led to that exception and can help you find which application method resulted in an error deep down your services or .NET stack – Panagiotis Kanavos Aug 25 '23 at 13:15

1 Answers1

0

The documentation doesn't state anything, so I don't know if this is supported. For me, what you say, it's not working using the Dapr .NET SDK. The Response.Content is always empty.

I tried using the InnerException of the InvocationException. But it seems that it is an HttRequestException and it doesn't contain any information about the original Exception thrown in the target service.

akakarikos
  • 45
  • 1
  • 1
  • 6
  • 2
    *No* API returns internal exceptions. That's a basic security rule – Panagiotis Kanavos Aug 25 '23 at 13:11
  • Thanks @PanagiotisKanavos. So that means, for this case, the way to go in order to get the inner exception is to go with a plain HTTP call instead of utilizing the Dapr .NET API, correct? – akakarikos Aug 28 '23 at 10:50