@@ -10,7 +10,6 @@ import (
1010 "testing"
1111
1212 "github.com/stretchr/testify/require"
13- "golang.org/x/xerrors"
1413
1514 "github.com/ydb-platform/ydb-go-sdk/v3"
1615 "github.com/ydb-platform/ydb-go-sdk/v3/table"
@@ -54,15 +53,31 @@ func TestIssue415ScanError(t *testing.T) {
5453 return res .Err ()
5554 }, table .WithTxSettings (table .TxSettings (table .WithSnapshotReadOnly ())))
5655 require .Error (t , err )
57- err = func (err error ) error {
58- for {
59- //nolint:errorlint
60- if unwrappedErr , has := err .(xerrors.Wrapper ); has {
61- err = unwrappedErr .Unwrap ()
62- } else {
63- return err
64- }
65- }
66- }(err )
6756 require .ErrorContains (t , err , "not found column 'ghi'" )
6857}
58+
59+ // https://github.com/ydb-platform/ydb-go-sdk/issues/847
60+ func TestIssue847ScanError (t * testing.T ) {
61+ ctx , cancel := context .WithCancel (context .Background ())
62+ defer cancel ()
63+
64+ db , err := ydb .Open (ctx ,
65+ os .Getenv ("YDB_CONNECTION_STRING" ),
66+ ydb .WithAccessTokenCredentials (os .Getenv ("YDB_ACCESS_TOKEN_CREDENTIALS" )),
67+ )
68+ require .NoError (t , err )
69+ err = db .Table ().Do (ctx , func (ctx context.Context , s table.Session ) (err error ) {
70+ res , err := s .StreamExecuteScanQuery (ctx , `SELICT 1;` , nil )
71+ if err != nil {
72+ return err
73+ }
74+ err = res .NextResultSetErr (ctx )
75+ if err != nil {
76+ return err
77+ }
78+ return res .Err ()
79+ }, table .WithTxSettings (table .TxSettings (table .WithSnapshotReadOnly ())))
80+ require .Error (t , err )
81+ t .Log (err )
82+ require .ErrorContains (t , err , "Unexpected token 'SELICT'" )
83+ }
0 commit comments