Skip to content

Commit 86c5f96

Browse files
committed
standardize error handling
1 parent cff66be commit 86c5f96

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

source/code-snippets/find.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"context"
55
"fmt"
6-
"log"
76

87
"go.mongodb.org/mongo-driver/bson"
98
"go.mongodb.org/mongo-driver/mongo"
@@ -33,12 +32,12 @@ func main() {
3332
// end find
3433

3534
if err != nil {
36-
log.Fatal(err)
35+
panic(err)
3736
}
3837

3938
var results []bson.M
4039
if err = cursor.All(context.TODO(), &results); err != nil {
41-
log.Fatal(err)
40+
panic(err)
4241
}
4342
for _, result := range results {
4443
fmt.Println(result)

0 commit comments

Comments
 (0)