Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions example_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package mgo

import "fmt"

func ExampleQueryError() {
e := &QueryError{
Code: 17406,
Message: "getMore executor error: CappedPositionLost: CollectionScan died due to failure to restore tailable cursor position. Last seen record id: RecordId(200138)",
Assertion: false,
}
fmt.Println(e.String())
// Output:
// getMore executor error: CappedPositionLost: CollectionScan died due to failure to restore tailable cursor position. Last seen record id: RecordId(200138)
}
3 changes: 3 additions & 0 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2397,7 +2397,10 @@ type queryError struct {
AssertionCode int "assertionCode"
}

// QueryError indicates an error that occurred during a Mongo query.
type QueryError struct {
// A list of codes can be found here:
// https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.err
Code int
Message string
Assertion bool
Expand Down