What is the best way to handle errors in gRPC-Web?

⚓ Rust    📅 2026-01-19    👤 surdeus    👁️ 7      

surdeus

Hello everyone, my team is currently using grpc-web in our project, but we have two different opinions within the team regarding error handling. I would appreciate it if someone could offer us some assistance.

1. Native gRPC Status

Keep .proto files clean. Use standard gRPC status codes. Use error messages in trailers. The frontend catches errors in the err object.

2. Custom Envelope

Wrap every response in the .proto file.
Example:

message Response { 
    int32 code = 1; 
    string msg = 2; 
    Any data = 3;
}

Which way is the "best practice" for grpc-web?

1 post - 1 participant

Read full topic

🏷️ Rust_feed