limeuser / appengine-ndb-experiment

Automatically exported from code.google.com/p/appengine-ndb-experiment
Other
0 stars 0 forks source link

Misleading exception and stacktrace using tasklets #237

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Given something like this:

from funcargs import *

from google.appengine.ext import ndb

class Foo(ndb.Model):
    name = ndb.StringProperty()

@ndb.tasklet
def find_the_bug(foo):
    yield foo.put_async()
    yield foo.key.delete()

class TestConfusingStacktrace:
    def testA(self, ndb):
        foo = Foo(name='A')
        foo.put()

        find_the_bug(foo).get_result()

throws 

...
RuntimeError: A tasklet should not yield a plain value: suspended generator find
_the_bug(strc_test.py:11) yielded None

The line number strc_test.py:11 unfortunately refers to the last correct yield 
statement. In this case foo.put_async()

It should point me to foo.key.delete() so I see the missing '_async' right 
away. 

Original issue reported on code.google.com by herr.ka...@gmail.com on 18 Jan 2013 at 4:58