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

Include tag key in Unmarshal error message

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • Labels:

      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.

            Assignee:
            Unassigned Unassigned
            Reporter:
            adinoyi.omuya@mongodb.com Adinoyi Omuya
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: