diff options
author | rubenwardy <rw@rubenwardy.com> | 2018-05-14 01:20:02 +0100 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2018-05-14 01:20:02 +0100 |
commit | e6a3836aab3e16dd2201136d0112d92f0b3356d6 (patch) | |
tree | 68dbf52c63588304a260ff6fc0911604d23856dd /app/tasks/importtasks.py | |
parent | 73fa5d11866e1ab36463c3a773b8ca0d3671a709 (diff) | |
download | cheatdb-e6a3836aab3e16dd2201136d0112d92f0b3356d6.tar.xz |
Hide all non-TaskError exceptions from users
Diffstat (limited to 'app/tasks/importtasks.py')
-rw-r--r-- | app/tasks/importtasks.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/app/tasks/importtasks.py b/app/tasks/importtasks.py index 7233d87..12b61dd 100644 --- a/app/tasks/importtasks.py +++ b/app/tasks/importtasks.py @@ -4,14 +4,7 @@ import urllib.request from urllib.parse import urlparse, quote_plus from app import app from app.models import * -from app.tasks import celery - -class TaskError(Exception): - def __init__(self, value): - self.value = value - def __str__(self): - return repr(self.value) - +from app.tasks import celery, TaskError class GithubURLMaker: def __init__(self, url): @@ -177,6 +170,7 @@ def getMeta(urlstr, author): @celery.task() def makeVCSRelease(id, branch): release = PackageRelease.query.get(id) + if release is None: raise TaskError("No such release!") |