Skip to content

Commit

Permalink
GODRIVER-2758: Use log.Fatal instead of panic
Browse files Browse the repository at this point in the history
  • Loading branch information
pmeredit committed Aug 15, 2024
1 parent 3a21e18 commit 3500d8e
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions mongo/client_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func ExampleConnect_aWS() {
context.TODO(),
options.Client().SetAuth(awsCredential))
if err != nil {
panic(err)
log.Fatal(err)
}
_ = awsIAMClient

Expand All @@ -315,7 +315,7 @@ func ExampleConnect_aWS() {
context.TODO(),
options.Client().SetAuth(assumeRoleCredential))
if err != nil {
panic(err)
log.Fatal(err)
}
_ = assumeRoleClient

Expand All @@ -337,7 +337,7 @@ func ExampleConnect_aWS() {
context.TODO(),
options.Client().SetAuth(envVariablesCredential))
if err != nil {
panic(err)
log.Fatal(err)
}
_ = envVariablesClient

Expand All @@ -355,7 +355,7 @@ func ExampleConnect_aWS() {
context.TODO(),
options.Client().SetAuth(ecCredential))
if err != nil {
panic(err)
log.Fatal(err)
}
_ = ecClient
}
Expand Down Expand Up @@ -386,7 +386,7 @@ func ExampleConnect_stableAPI() {
context.TODO(),
options.Client().SetServerAPIOptions(serverAPI))
if err != nil {
panic(err)
log.Fatal(err)
}
_ = serverAPIClient

Expand All @@ -401,7 +401,7 @@ func ExampleConnect_stableAPI() {
context.TODO(),
options.Client().SetServerAPIOptions(serverAPIStrict))
if err != nil {
panic(err)
log.Fatal(err)
}

coll := serverAPIStrictClient.Database("db").Collection("coll")
Expand All @@ -420,7 +420,7 @@ func ExampleConnect_stableAPI() {
context.TODO(),
options.Client().SetServerAPIOptions(serverAPIDeprecation))
if err != nil {
panic(err)
log.Fatal(err)
}
_ = serverAPIDeprecationClient
}
Expand All @@ -445,11 +445,11 @@ func ExampleConnect_bSONOptions() {

client, err := mongo.Connect(context.TODO(), clientOpts)
if err != nil {
panic(err)
log.Fatal(err)
}
defer func() {
if err := client.Disconnect(context.TODO()); err != nil {
panic(err)
log.Fatal(err)
}
}()

Expand All @@ -466,7 +466,7 @@ func ExampleConnect_bSONOptions() {
// resulting BSON document to have a structure like {"a": {}, "b": []}
_, err = coll.InsertOne(context.TODO(), myDocument{})
if err != nil {
panic(err)
log.Fatal(err)
}
}

Expand Down Expand Up @@ -504,7 +504,7 @@ func ExampleConnect_oIDC() {
)
c, err := mongo.Connect(context.TODO(), opts)
if err != nil {
panic(err)
log.Fatal(err)
}
defer c.Disconnect(context.TODO())
c.Database("test").Collection("test").InsertOne(context.TODO(), bson.D{})
Expand All @@ -530,7 +530,7 @@ func ExampleConnect_oIDC() {
)
c, err := mongo.Connect(context.TODO(), opts)
if err != nil {
panic(err)
log.Fatal(err)
}
defer c.Disconnect(context.TODO())
c.Database("test").Collection("test").InsertOne(context.TODO(), bson.D{})
Expand Down Expand Up @@ -568,7 +568,7 @@ func ExampleConnect_oIDC() {
)
c, err := mongo.Connect(context.TODO(), opts)
if err != nil {
panic(err)
log.Fatal(err)
}
defer c.Disconnect(context.TODO())
c.Database("test").Collection("test").InsertOne(context.TODO(), bson.D{})
Expand Down Expand Up @@ -608,7 +608,7 @@ func ExampleConnect_oIDC() {
)
c, err := mongo.Connect(context.TODO(), opts)
if err != nil {
panic(err)
log.Fatal(err)
}
defer c.Disconnect(context.TODO())
c.Database("test").Collection("test").InsertOne(context.TODO(), bson.D{})
Expand Down Expand Up @@ -649,7 +649,7 @@ func ExampleConnect_oIDC() {
)
c, err := mongo.Connect(context.TODO(), opts)
if err != nil {
panic(err)
log.Fatal(err)
}
defer c.Disconnect(context.TODO())
c.Database("test").Collection("test").InsertOne(context.TODO(), bson.D{})
Expand Down

0 comments on commit 3500d8e

Please sign in to comment.