Skip to content

Commit a9b798c

Browse files
George RybakovGeorge Rybakov
authored andcommitted
fix: add error handling for example_test
Error handling was added, as their absence led to SIGSEGV. Closes TNTP-4101
1 parent 08319d4 commit a9b798c

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

example_test.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func upTarantool() (func(), error) {
203203
})
204204
if err != nil {
205205
test_helpers.StopTarantoolWithCleanup(inst)
206-
return nil, nil
206+
return nil, err
207207
}
208208

209209
cleanup := func() {
@@ -235,7 +235,11 @@ func ExampleMap_insertMappedTuples() {
235235
}
236236
defer cleanupTarantool()
237237

238-
conn, _ := tarantool.Connect(context.Background(), dialer, opts)
238+
conn, err := tarantool.Connect(context.Background(), dialer, opts)
239+
if err != nil {
240+
fmt.Printf("can't connect to tarantool: %v\n", err)
241+
return
242+
}
239243
defer conn.Close()
240244

241245
var spaceFmtResp [][]tupleconv.SpaceField
@@ -313,7 +317,11 @@ func Example_ttEncoder() {
313317
tupleEncoder := tupleconv.MakeMapper([]tupleconv.Converter[any, string]{}).
314318
WithDefaultConverter(converter)
315319

316-
conn, _ := tarantool.Connect(context.Background(), dialer, opts)
320+
conn, err := tarantool.Connect(context.Background(), dialer, opts)
321+
if err != nil {
322+
fmt.Printf("can't connect to tarantool: %v\n", err)
323+
return
324+
}
317325
defer conn.Close()
318326

319327
req := tarantool.NewSelectRequest("finances")

0 commit comments

Comments
 (0)