title: How to get grpc to throw the original exception like WCF does?
body: <p>I was wondering whether there is a way to have Grpc .Net Core throw the original exception of the server side back to the client.</p>
  <p>The problem is the following. When calling a grpc service, for example:</p>
  <p>Client:</p>
  <pre><code>using (var channel = GrpcChannel.ForAddress(&quot;http://localhost:10042&quot;))
  {
      var greeterService = channel.CreateGrpcService&lt;IGreetService&gt;();
      var result = await greeterService.Greet();
  
      Console.WriteLine(result.Greet);
  }
  </code></pre>
  <p>Server:</p>
  <pre><code>public async Task&lt;Greeting&gt; Greet()
  {
      throw new ArgumentException();
  }
  </code></pre>
  <p>Running this, the following RpcException is raised:</p>
  <pre><code>Grpc.Core.RpcException: 'Status(StatusCode=Unknown, Detail=&quot;Exception was thrown by handler.&quot;)'
  </code></pre>
  <p>Now, I would very much like to get this in a direction of actually raising an ArgumentException on the client side so this can be handled better.</p>
  <p>What is possible, so I figured, is to do the following in my Startup.cs:</p>
  <pre><code>services.AddCodeFirstGrpc(options =&gt; options.EnableDetailedErrors = true); 
  </code></pre>
  <p>Result:</p>
  <pre><code>Grpc.Core.RpcException: 'Status(StatusCode=Unknown, Detail=&quot;Exception was thrown by handler. ArgumentException: Value does not fall within the expected range.&quot;)'
  </code></pre>
  <p>That's better, but still not perfect.</p>
  <p>My question is - Can I somehow raise the servers exception on the client side? Something I read up on was the fact that grpc allows &quot;Interceptors&quot; to intercept grpc calls. Is this a possibility to maybe do something here?</p>