Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: return internal error code for request query shortpath (#13702)

h3n4l5f257cee7530
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index 41b719173d..55c4f805a2 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -248,7 +248,11 @@ func (s *SQLService) Query(ctx context.Context, request *v1pb.QueryRequest) (*v1
return nil, err
}
if queryErr != nil {
- return nil, status.Error(codes.Internal, queryErr.Error())
+ code := codes.Internal
+ if status, ok := status.FromError(queryErr); ok && status.Code() != codes.OK && status.Code() != codes.Unknown {
+ code = status.Code()
+ }
+ return nil, status.Error(code, queryErr.Error())
}
allowExport := true