func (self *AI) AddError(c common.Context, turnId *datastore.Key, err error) { _, e := datastore.Put(c, datastore.NewKey(c, AIErrorKind, "", 0, self.Id), &AIError{ CreatedAt: time.Now(), Turn: turnId, ErrorBytes: []byte(err.Error()), ErrorDetail1Bytes: []byte(fmt.Sprintf("%+v", err)), ErrorDetail2Bytes: []byte(fmt.Sprintf("%#v", err)), }) if e != nil { c.Errorf("Got %+v when trying to save a new error!", e) } common.MemDel(c, aiErrorsKeyByParent(self.Id)) }