summaryrefslogtreecommitdiff
path: root/api.py
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-02-27 14:37:13 +0100
committerschneefux <schneefux+commit@schneefux.xyz>2017-02-27 14:37:13 +0100
commit7f4850d8bf0b99d1ad94a4bc7d34d5b8949776f0 (patch)
tree2cb7b04292f0ba43ab6a145186deb967f3f7e565 /api.py
parente563704f337d47c1f5bbd632d053b275d443ec49 (diff)
parentb4cbe522fae1e379466b64ac8e3a06c3e45ce26a (diff)
downloadapigrabber-7f4850d8bf0b99d1ad94a4bc7d34d5b8949776f0.tar.gz
apigrabber-7f4850d8bf0b99d1ad94a4bc7d34d5b8949776f0.zip
Merge branch 'errors'
Diffstat (limited to 'api.py')
-rw-r--r--api.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/api.py b/api.py
index 2dfa964..1da9e8d 100644
--- a/api.py
+++ b/api.py
@@ -69,8 +69,12 @@ class Worker(object):
if jobid is None:
raise LookupError("no jobs available")
logging.debug("%s: starting job", jobid)
- await self._execute_job(jobid, payload, priority)
- await self._queue.finish(jobid)
+ try:
+ await self._execute_job(jobid, payload, priority)
+ await self._queue.finish(jobid)
+ except crawler.ApiError as error:
+ logging.warning("%s: failed", jobid)
+ await self._queue.fail(jobid, error.args[0])
logging.debug("%s: finished job", jobid)
async def run(self):