zalgonoise/zlog

[gRPC] Improve error handling

Closed this issue · 0 comments

gRPC errors are currently being handled with a *regexp.Regexp which matches the error message. This is of course, not ideal.

Looking into gRPC's error handling in Go, the error can be parsed by the status package, and then checked against one of its values from the codes package:

if errCode := status.Code(err) ; errCode == codes.Unavailable {
  // handle gRPC -- "unavailable" errors
}