Skip to content

Commit

Permalink
Do not encode error before logging
Browse files Browse the repository at this point in the history
  • Loading branch information
steve-hb committed Feb 10, 2024
1 parent a84d37c commit 3cd1363
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions pkg/gintx/neo4j.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package gintx

import (
"encoding/json"
"github.com/gin-gonic/gin"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -38,12 +37,7 @@ func BuildNeo4JTransactionMiddleware(sessionConfig neo4j.SessionConfig, driver n

defer func() {
if err := recover(); err != nil {
encodedError, marshalError := json.Marshal(err)
if marshalError != nil {
encodedError = []byte("MARSHAL_ERROR")
}

logrus.WithField("error", string(encodedError)).Info("Starting neo4j recovery process.")
logrus.WithField("error", err).Info("Starting neo4j recovery process.")

err := tx.Rollback(ctx)
if err != nil {
Expand Down

0 comments on commit 3cd1363

Please sign in to comment.