Ver código fonte

Update error_handler example. Closes #2288

Ask Solem 10 anos atrás
pai
commit
b7f5e9a4bf
1 arquivos alterados com 4 adições e 5 exclusões
  1. 4 5
      docs/userguide/calling.rst

+ 4 - 5
docs/userguide/calling.rst

@@ -144,12 +144,11 @@ This is an example error callback:
 
 .. code-block:: python
 
-    @app.task
-    def error_handler(uuid):
-        result = AsyncResult(uuid)
-        exc = result.get(propagate=False)
+    @app.task(bind=True)
+    def error_handler(self, uuid):
+        result = self.app.AsyncResult(uuid)
         print('Task {0} raised exception: {1!r}\n{2!r}'.format(
-              uuid, exc, result.traceback))
+              uuid, result.result, result.traceback))
 
 it can be added to the task using the ``link_error`` execution
 option: