Catch QueueNotFound error in TQ REST API
@@ -7,6 +7,8 @@ from tornado import gen
from tornado.web import MissingArgumentError, RequestHandler
from appscale.common.constants import HTTPCodes
+
+from appscale.taskqueue.constants import QueueNotFound
from appscale.taskqueue.statistics import service_stats, stats_lock, REST_API
from .constants import TaskNotFound
@@ -92,8 +94,9 @@ class RESTQueue(TrackedRequestHandler):
project: A string containing an application ID.
queue: A string containing a queue name.
"""
+ try:
queue = self.queue_handler.get_queue(project, queue)
- if queue is None:
+ except QueueNotFound:
write_error(self, HTTPCodes.NOT_FOUND, 'Queue not found.')
return
