You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "zeroshade (via GitHub)" <gi...@apache.org> on 2024/09/24 21:37:40 UTC
Re: [PR] feat(go/adbc/driver/flightsql): Improvements for flightSql error details [arrow-adbc]
zeroshade commented on code in PR #2185:
URL: https://github.com/apache/arrow-adbc/pull/2185#discussion_r1774122488
##########
go/adbc/driver/flightsql/utils.go:
##########
@@ -126,6 +137,9 @@ func adbcFromFlightStatusWithDetails(err error, header, trailer metadata.MD, con
}
default:
for _, value := range values {
+ if strings.HasPrefix(value, "Grpc-") {
+ continue
+ }
Review Comment:
same question as above
##########
go/adbc/driver/flightsql/utils.go:
##########
@@ -30,13 +30,15 @@ import (
"google.golang.org/protobuf/types/known/anypb"
)
+const grpcStatusDetailsBin = "grpc-status-details-bin"
+
func adbcFromFlightStatus(err error, context string, args ...any) error {
var header, trailer metadata.MD
return adbcFromFlightStatusWithDetails(err, header, trailer, context, args...)
}
func adbcFromFlightStatusWithDetails(err error, header, trailer metadata.MD, context string, args ...any) error {
- if _, ok := err.(adbc.Error); ok {
+ if _, ok := adbc.AdbcError(err); ok {
Review Comment:
`if errors.Is(err, adbc.Error{}) {`
##########
go/adbc/adbc.go:
##########
@@ -130,6 +131,16 @@ type Error struct {
Details []ErrorDetail
}
+// AdbcError helper function returns an adbc.Error representation
+// of a given error
+func AdbcError(err error) (*Error, bool) {
+ var adbcErr Error
+ if errors.As(err, &adbcErr) {
+ return &adbcErr, true
+ }
+ return nil, false
+}
Review Comment:
I don't find this particular function very useful. Consumers should just use `errors.As` and `errors.Is` themselves rather than needing to use this function directly
##########
go/adbc/driver/flightsql/utils.go:
##########
@@ -107,6 +115,9 @@ func adbcFromFlightStatusWithDetails(err error, header, trailer metadata.MD, con
}
default:
for _, value := range values {
+ if strings.HasPrefix(value, "Grpc-") {
+ continue
+ }
Review Comment:
why skip things with `Grpc-` prefix?
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org