Hide all non-TaskError exceptions from users
This commit is contained in:
@@ -4,6 +4,12 @@ from celery import Celery
|
||||
from app import app
|
||||
from app.models import *
|
||||
|
||||
class TaskError(Exception):
|
||||
def __init__(self, value):
|
||||
self.value = value
|
||||
def __str__(self):
|
||||
return repr("TaskError: " + self.value)
|
||||
|
||||
class FlaskCelery(Celery):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FlaskCelery, self).__init__(*args, **kwargs)
|
||||
|
||||
@@ -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!")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user