Set Details In Error Response Http Call (Using GRPC) In Python – Stack Overflow

I have an API with this proto like :

service SmartLocationFavourites {
  rpc SmartSuggestion(SmartSuggestionRequest) returns (SmartSuggestionReply) {
    option (google.api.http) = {
      get: "/api/v3/smartSuggestion"

message ErrorDetail {
  string code = 1;
  optional string payload = 2;

Additional to SmartSuggestionReply response, I want to have a grpc_error_handler which returns error when error occurs.
The sample of error i want is like this:

    "code": 3,
    "message": "MY MESSAGE",
    "details": [
            "@type": "",
            "code": "MY_SAMPLE_ERROR_CODE"

the problem is i cant set details and message in python (with using return or rise an error)

Read more here: Source link