Include tag key in Unmarshal error message

XMLWordPrintableJSON

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

      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
              Reporter:
              Adinoyi Omuya (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: