Skip to content

Commit

Permalink
chore(mongox): log transaction error (#56)
Browse files Browse the repository at this point in the history
* chore(mongox): log transaction error

* Update mongox/collection.go

Co-authored-by: rot1024 <[email protected]>

---------

Co-authored-by: rot1024 <[email protected]>
  • Loading branch information
yk-eukarya and rot1024 authored Nov 21, 2024
1 parent 4c43777 commit a7f7b61
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mongox/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"

"github.com/reearth/reearthx/log"
"github.com/reearth/reearthx/rerror"
"github.com/reearth/reearthx/usecasex"
"go.mongodb.org/mongo-driver/bson"
Expand Down Expand Up @@ -320,6 +321,7 @@ func getCursor(raw bson.Raw) (*usecasex.Cursor, error) {

func wrapError(ctx context.Context, err error) error {
if IsTransactionError(err) {
log.Errorfc(ctx, "transaction error: %v", err)
return usecasex.ErrTransaction
}
return rerror.ErrInternalByWithContext(ctx, err)
Expand Down

0 comments on commit a7f7b61

Please sign in to comment.