zeroshade commented on code in PR #1577:
URL: https://github.com/apache/arrow-adbc/pull/1577#discussion_r1509358485
##########
go/adbc/driver/flightsql/utils.go:
##########
@@ -92,19 +93,37 @@ func adbcFromFlightStatusWithDetails(err error, header,
trailer metadata.MD, con
// XXX: must check both headers and trailers because some
implementations
// (like gRPC-Java) will consolidate trailers into headers for failed
RPCs
for key, values := range header {
- switch key {
- case "content-type", "grpc-status-details-bin":
+ switch {
+ case key == "content-type":
+ // Not useful info
continue
+ case key == "grpc-status-details-bin":
+ // gRPC library parses this above via grpcStatus.Proto()
+ continue
+ case strings.HasSuffix(key, "-bin"):
+ for _, value := range values {
+ // that's right, gRPC stuffs binary data into a
"string"
+ details = append(details,
&adbc.BinaryErrorDetail{Name: key, Detail: []byte(value)})
+ }
default:
for _, value := range values {
details = append(details,
&adbc.TextErrorDetail{Name: key, Detail: value})
}
}
Review Comment:
Could we leverage
https://pkg.go.dev/google.golang.org/[email protected]/status#Convert instead to get
the message, error and details from the `err` instead of having to dig into the
headers/trailers? Or is it not the same information?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]