Skip to content

Commit

Permalink
TestKit: serialize Neo4j error messages (#604)
Browse files Browse the repository at this point in the history
  • Loading branch information
robsdedude authored Oct 4, 2024
1 parent 9e6857b commit 8d40e8b
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions testkit-backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,20 @@ func (b *backend) writeError(err error) {
neo4j.IsTransactionExecutionLimit(err)

if isDriverError {
var msg, errorType string
if neo4jError, ok := err.(*neo4j.Neo4jError); ok {
msg = neo4jError.Msg
errorType = "Neo4jError"
} else {
msg = err.Error()
errorType = strings.Split(err.Error(), ":")[0]
}

id := b.setError(err)
b.writeResponse("DriverError", map[string]any{
"id": id,
"errorType": strings.Split(err.Error(), ":")[0],
"msg": err.Error(),
"errorType": errorType,
"msg": msg,
"code": code,
"retryable": retriable,
})
Expand Down

0 comments on commit 8d40e8b

Please # to comment.