From 2c2a28e46b836f497e7d5f09bbb5cf25e757a525 Mon Sep 17 00:00:00 2001 From: Eli Uriegas Date: Sat, 18 Feb 2017 12:29:25 -0600 Subject: [PATCH] Add better error message around app.loop --- sanic/app.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sanic/app.py b/sanic/app.py index 6552a8e2..ea45293a 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -57,11 +57,14 @@ class Sanic: @property 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: raise SanicException( '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() # -------------------------------------------------------------------- #