[GODRIVER-1854] Make "ErrNilDocument" and "ErrNilValue" more specific Created: 01/Feb/21  Updated: 08/Jan/24

Status: Backlog
Project: Go Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0.0

Type: Improvement Priority: Major - P3
Reporter: Isabella Siu (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by GODRIVER-773 Improve context of 'document is nil' ... Closed
Related
related to GODRIVER-2704 Replace all input validation error co... Backlog
Epic Link: Go Driver 2.0: Driver
Backwards Compatibility: Major Change

 Description   

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?

Generated at Thu Feb 08 08:37:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.