Skip to content

Commit 33b7c6e

Browse files
authored
Merge pull request #2115 from mmcclimon/drivertest-named-error
drivertest: name an anonymous error
2 parents 015d649 + e20ed46 commit 33b7c6e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

x/mongo/driver/drivertest/opmsg_deployment.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ var (
4545
Max: driverutil.MaxWireVersion,
4646
},
4747
}
48+
49+
// ErrNoResponsesRemaining is the error returned when the mocked connection is asked for a response and does not have
50+
// any responses buffered.
51+
ErrNoResponsesRemaining = errors.New("no responses remaining")
4852
)
4953

5054
// connection implements the driver.Connection interface and responds to wire messages with pre-configured responses.
@@ -71,7 +75,7 @@ func (c *connection) SetOIDCTokenGenID(uint64) {
7175
func (c *connection) Read(_ context.Context) ([]byte, error) {
7276
var dst []byte
7377
if len(c.responses) == 0 {
74-
return dst, errors.New("no responses remaining")
78+
return dst, ErrNoResponsesRemaining
7579
}
7680
nextRes := c.responses[0]
7781
c.responses = c.responses[1:]

0 commit comments

Comments
 (0)