Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1854

Make "ErrNilDocument" and "ErrNilValue" more specific

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Major Change

      The current ErrNilDocument and ErrNilValue error values sometimes leave users confused because the errors don't say anything about what part of the input document or value was nil. Replace all uses of ErrNilDocument and ErrNilValue with a new error type InvalidArgumentError that gives more information about why the input is invalid (e.g. "id field cannot be nil" or "document at index 4 is nil").

      Definition of done:

      • Remove ErrNilDocument and ErrNilValue.
      • Add a new type InvalidArgumentError that
      • Make the new InvalidArgumentError satisfy the errors.Is and errors.As APIs by implementing Is and As functions.
      • Update all uses of ErrNilDocument and ErrNilValue to return an InvalidArgumentError with additional information about what part of the input was invalid.

      Open questions:

      • Should we remove the ErrNilDocument and ErrNilValue errors or keep them and wrap them with an InvalidArgumentError?

            Assignee:
            Unassigned Unassigned
            Reporter:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: