[GODRIVER-1118] Include tag key in Unmarshal error message Created: 10/Jun/19  Updated: 26/May/20  Resolved: 26/May/20

Status: Closed
Project: Go Driver
Component/s: BSON
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Adinoyi Omuya Assignee: Unassigned
Resolution: Duplicate Votes: 2
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to GODRIVER-952 Lack of context in error description ... Closed

 Description   

With a type like:

type toy struct {
     a string `bson:"a"`
     b string `bson:"b"`
}

In the snippet below:

example := &toy{}
err := bson.Unmarshal(data, example)
....


If data contains `a` with a `nil` value, I get the error: "cannot decode null into a string type".

It would be helpful to get the full field path included in the error message as well.


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