chai
chai copied to clipboard
StructScan panics when the interface parameter is not a struct
What version of Genji are you using?
$ genji version Genji (devel) Genji CLI (devel)
What did you do?
StructScan panics when the api contract is not respected, it will be very good an error is returned instead of panic.
var b int
d := document.NewFieldBuffer().Add("a", types.NewIntegerValue(10))
err := document.StructScan(d, &b)
assert.Error(t, err)
What did you expect to see?
An error message.
target must be pointer to struct
What did you see instead?
panic: reflect: call of reflect.Value.NumField on int Value [recovered]
panic: reflect: call of reflect.Value.NumField on int Value