Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when a handler returns something other than a Response #87

Open
samuelcolvin opened this issue Jan 4, 2017 · 0 comments
Open

Comments

@samuelcolvin
Copy link
Member

currently

# @template('index.jinja')
async def index(request):
    return {
        'foo': 'bar'
    }

will give cause an error in aiohttp-debugtoolbar:

Traceback (most recent call last):
  File "/home/samuel/code/purge_cloudflare/env/lib/python3.5/site-packages/aiohttp/web_server.py", line 61, in handle_request
    resp = yield from self._handler(request)
  File "/home/samuel/code/purge_cloudflare/env/lib/python3.5/site-packages/aiohttp/web.py", line 249, in _handle
    resp = yield from handler(request)
  File "/home/samuel/code/purge_cloudflare/env/lib/python3.5/site-packages/aiohttp_debugtoolbar/middlewares.py", line 122, in toolbar_middleware
    toolbar.status = response.status
AttributeError: 'dict' object has no attribute 'status'

instead I guess debug toolbar should show the

AssertionError: Handler <function index at 0x7f1b927b6510> should return response instance, got <class 'dict'> [middlewares []]

as it does for standard exceptions occurring in a handler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant