error can be obscure when marshalling illegal values

Bug #897584 reported by Roger Peppe
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
goyaml
Confirmed
Undecided
Unassigned

Bug Description

Here's a distilled example of a situation I encountered for real
(I'd forgotten to call Interface() on the reflect.Value that
I was adding to the map).

package main
import (
 "fmt"
 "launchpad.net/goyaml"
 "reflect"
)
func main() {
 x := map[string]interface{}{"hello": reflect.ValueOf(56)}
 _, err := goyaml.Marshal(x)
 fmt.Printf("error: %v\n", err)
}

This prints:
error: YAML error: reflect.Value.Interface: cannot return value obtained from unexported field or method

I think it would be desirable to include some kind of context with the error
(for example the type that caused the problem).

Changed in goyaml:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.