Skip to content

Commit 5ca3832

Browse files
GODRIVER-2616 Change CommandFailedEvent.Failure type to error (#1469)
1 parent 28a05e8 commit 5ca3832

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

event/monitoring.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ type CommandSucceededEvent struct {
5555
// CommandFailedEvent represents an event generated when a command's execution fails.
5656
type CommandFailedEvent struct {
5757
CommandFinishedEvent
58-
Failure string
58+
Failure error
5959
}
6060

6161
// CommandMonitor represents a monitor that is triggered for different events.

mongo/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func TestClient(t *testing.T) {
341341
t.Run(tc.name, func(t *testing.T) {
342342
// Setup a client and skip the test based on server version.
343343
var started []*event.CommandStartedEvent
344-
var failureReasons []string
344+
var failureReasons []error
345345
cmdMonitor := &event.CommandMonitor{
346346
Started: func(_ context.Context, evt *event.CommandStartedEvent) {
347347
if evt.CommandName == "endSessions" {

mongo/integration/unified/client_entity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ func (c *clientEntity) processFailedEvent(_ context.Context, evt *event.CommandF
408408
AppendString("commandName", evt.CommandName).
409409
AppendInt64("requestId", evt.RequestID).
410410
AppendString("connectionId", evt.ConnectionID).
411-
AppendString("failure", evt.Failure)
411+
AppendString("failure", evt.Failure.Error())
412412
if evt.ServiceID != nil {
413413
bsonBuilder.AppendString("serviceId", evt.ServiceID.String())
414414
}

x/mongo/driver/operation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2032,7 +2032,7 @@ func (op Operation) publishFinishedEvent(ctx context.Context, info finishedInfor
20322032
}
20332033

20342034
failedEvent := &event.CommandFailedEvent{
2035-
Failure: info.cmdErr.Error(),
2035+
Failure: info.cmdErr,
20362036
CommandFinishedEvent: finished,
20372037
}
20382038
op.CommandMonitor.Failed(ctx, failedEvent)

0 commit comments

Comments
 (0)