If a exception happened at one of trailing interceptors

gRPC somehow replace the response with _FailureOutcome 
<https://github.com/grpc/grpc/blob/4dd0bba12e90f490fcccef2dca1ae7e907cebbbf/src/python/grpcio/grpc/_interceptor.py#L88>
and makes the interceptor has no problem.

So I thought there should be some where wrapping
user overrided method 
<https://github.com/grpc/grpc/blob/4dd0bba12e90f490fcccef2dca1ae7e907cebbbf/examples/python/interceptors/default_value/default_value_client_interceptor.py#L60>
 
with try / except

and when Exception is raised, replace the response with _FailureOutcome 
<https://github.com/grpc/grpc/blob/4dd0bba12e90f490fcccef2dca1ae7e907cebbbf/src/python/grpcio/grpc/_interceptor.py#L88>

*pseudocode*

```python
# somewhere deep in grpcio ...

def run_user_defined_interceptor_method(response):
try :
response = intercept_unary_unary( continuation, client_call_details, request
   )
except Exception as e:
response = _FailureOutcome(exception = e)
return response
```
so even I run into a exception in interceptor and interceptor handle well
eventually at client code, not handling error 
<https://github.com/grpc/grpc/blob/4dd0bba12e90f490fcccef2dca1ae7e907cebbbf/examples/python/interceptors/default_value/greeter_client.py#L38>bump
 
into exception

I'm quite sure about how it works because 
codes under where exception happened doesn't run

I can't find where *those wrappings* are happened like pseudocode 

class 
<https://github.com/grpc/grpc/blob/4dd0bba12e90f490fcccef2dca1ae7e907cebbbf/src/python/grpcio/grpc/__init__.py#L426>
 
that implements abstract method "intercept_unary_unary"
has no more than a abstract code,

so as I said, there should be something more under grpcio

...

This design was impressive because
it looked like mocking kind of Javascript's then(), catch()
and async pattern, but not actually  async (in a way of propagating error) 
and makes it easy to trace errors 

most of all,  as a client side, it looks like real network connection even 
it was problem from interceptor

and as for enterprise level, it looked quite safe from unexpected errors

I have no experience with using gRPC as enterprise level, 
just got interested at gRPC, I'm senior freshman now.

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/21428500-e2c7-4083-b0e4-f4fdf66209e1n%40googlegroups.com.

Reply via email to