Add better error message around app.loop
This commit is contained in:
parent
c75d484f23
commit
2c2a28e46b
|
@ -57,11 +57,14 @@ class Sanic:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def loop(self):
|
def loop(self):
|
||||||
"""Synonymous with asyncio.get_event_loop()."""
|
"""Synonymous with asyncio.get_event_loop().
|
||||||
|
|
||||||
|
Only supported when using the `app.run` method.
|
||||||
|
"""
|
||||||
if not self.is_running:
|
if not self.is_running:
|
||||||
raise SanicException(
|
raise SanicException(
|
||||||
'Loop can only be retrieved after the app has started '
|
'Loop can only be retrieved after the app has started '
|
||||||
'running or when not run asynchronously')
|
'running. Not supported with `create_server` function')
|
||||||
return get_event_loop()
|
return get_event_loop()
|
||||||
|
|
||||||
# -------------------------------------------------------------------- #
|
# -------------------------------------------------------------------- #
|
||||||
|
|
Loading…
Reference in New Issue
Block a user