when -format-error option is used, format service reflection errors, too (#188)

This commit is contained in:
Mikhail Katychev
2020-09-30 17:24:46 +00:00
committed by GitHub
parent 9846afccbc
commit 9da71fbe53
2 changed files with 14 additions and 2 deletions

View File

@@ -695,7 +695,11 @@ func main() {
err = grpcurl.InvokeRPC(ctx, descSource, cc, symbol, append(addlHeaders, rpcHeaders...), h, rf.Next)
if err != nil {
fail(err, "Error invoking method %q", symbol)
if errStatus, ok := status.FromError(err); ok && *formatError {
h.Status = errStatus
} else {
fail(err, "Error invoking method %q", symbol)
}
}
reqSuffix := ""
respSuffix := ""