July 2018
Intermediate to advanced
324 pages
8h 14m
English
In order to raise an exception in the asynchronous Lambda invocation, we need to have a mechanism to instantiate an asynchronous Lambda function. Let's write a resource API and call an asynchronous task, which will raise an exception.
The following is the updated code of resources.py:
import falconfrom zappa.async import taskfrom mashape import fetch_quoteclass RandomQuoteResource: def on_get(self, req, resp): """Handles GET requests""" try: resp.media = fetch_quote() except Exception as e: raise falcon.HTTPError(falcon.HTTP_500, str(e))@taskdef async_task(): raise ValueError("Async Failure Exception")class AsyncTaskResource: def on_get(self, req, resp): """Handles GET requests""" try: ...Read now
Unlock full access