google / rejoiner

Generates a unified GraphQL schema from gRPC microservices and other Protobuf sources
https://google.github.io/rejoiner/
Apache License 2.0
3.67k stars 139 forks source link

Rejoiner wraps grpc exception with InvocationTargetException and display it in the graphql error field #55

Open arc-008 opened 6 years ago

arc-008 commented 6 years ago

Issue : When there is an exception from grpc services, it appears that the exception is being wrapped with "InvocationTargetException" and the graphql error field contains that one.

Expected Behaviour : Is there a way that I can suppress "InvocationTargetException" and based on grpc exception, I can rewrite the graphql error fields.

Analysis : While investigating, the "rejoiner"s "SchemaModule" covers the grpc exception with the "InvocationTargetException" and the graphql "error" fields always has error like below,

"Exception while fetching data (/someGrpcService) : java.lang.reflect.InvocationTargetException"

Tried GraphQl "ExecutionStrategy" to override "graphql.execution.SimpleDataFetcherExceptionHandler" in the "Handler" implementation, but for reason that never gets invoked.

Any idea how to do the error handling ?

arc-008 commented 6 years ago

I do see the fix here.