In C# status server handlers (and also in interceptors on the serverside), 
you can set the resulting status without throwing an exception by setting 
ServerCallContext's "Status" property.

call.Status = new Status(StatusCode.WhateverYouWant, "");
// and then return from the server side handler.

A test that demonstrates this is 

On Tuesday, April 3, 2018 at 11:25:18 AM UTC+2, Joseph Vaughan wrote:
> I have a few instances where I'd like my gRPC server to reject an RPC call 
> using the newly introduced Interceptors functionality. I've read the 
> documentation and can see that this is a desired piece of functionality 
> (Cancelling 
> RPCs <>). I can 
> see the functionality is available within the Java API ( 
> <>)
> which looks perfect for what I'd like to do (Cancel the RPC and return one 
> of the internal gRPC status codes). The best solution I can find right now 
> for a C# server is to raise an RpcException with a Status, however I'd like 
> to avoid the use of exceptions for common control flow where possible. 
> Ideally I'm looking for the same functionality as demonstrated here: 
> Am I missing something on the C# side where I can already do this, and if 
> not, are there plans to introduce a similar API?
> Thanks,
> Joseph.

You received this message because you are subscribed to the Google Groups 
"" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to