Index: service/datastore/multiarg.go |
diff --git a/service/datastore/multiarg.go b/service/datastore/multiarg.go |
index cc1a6726510f6817887f6539a42ba276c780e78b..ad141d3db7bd4c88becbdeb6682d89531df7bc53 100644 |
--- a/service/datastore/multiarg.go |
+++ b/service/datastore/multiarg.go |
@@ -258,23 +258,45 @@ func multiArgTypeInterface() multiArgType { |
func newKeyObjErr(aid, ns string, src interface{}) (*Key, error) { |
pls := getMGS(src) |
- if key, _ := pls.GetMetaDefault("key", nil).(*Key); key != nil { |
+ keyI, err := GetMetaDefault(pls, "key", nil) |
+ if err != nil { |
+ return nil, err |
+ } |
+ if key, _ := keyI.(*Key); key != nil { |
return key, nil |
} |
// get kind |
- kind := pls.GetMetaDefault("kind", "").(string) |
+ kindI, err := GetMetaDefault(pls, "kind", "") |
+ if err != nil { |
+ return nil, err |
+ } |
+ |
+ kind, _ := kindI.(string) |
if kind == "" { |
return nil, fmt.Errorf("unable to extract $kind from %T", src) |
} |
// get id - allow both to be default for default keys |
- sid := pls.GetMetaDefault("id", "").(string) |
- iid := pls.GetMetaDefault("id", 0).(int64) |
+ sidI, err := GetMetaDefault(pls, "id", "") |
+ if err != nil { |
+ return nil, err |
+ } |
+ |
+ iidI, err := GetMetaDefault(pls, "id", 0) |
+ if err != nil { |
+ return nil, err |
+ } |
// get parent |
- par, _ := pls.GetMetaDefault("parent", nil).(*Key) |
+ parI, err := GetMetaDefault(pls, "parent", nil) |
+ if err != nil { |
+ return nil, err |
+ } |
+ iid, _ := iidI.(int64) |
+ sid, _ := sidI.(string) |
+ par, _ := parI.(*Key) |
return NewKey(aid, ns, kind, sid, iid, par), nil |
} |