Skip to content

Commit 49e2ada

Browse files
handles errors related to Rounds not fetching
1 parent 8b57ee7 commit 49e2ada

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

montage/rdb.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737

3838
from clastic.errors import Forbidden
3939

40+
import logging
41+
logger = logging.getLogger(__name__)
42+
4043
from .utils import (format_date,
4144
basestring,
4245
to_unicode,
@@ -1554,7 +1557,12 @@ def activate_round(self, round_id):
15541557
return
15551558

15561559
def add_entries_from_cat(self, round_id, cat_name):
1557-
rnd = self.user_dao.get_round(round_id)
1560+
try:
1561+
rnd = self.user_dao.get_round(round_id)
1562+
except Exception as e:
1563+
logger.error("Round not found: %s", round_id)
1564+
raise InvalidAction("Round not found")
1565+
15581566
if ENV_NAME == 'dev':
15591567
source = 'remote'
15601568
else:
@@ -1569,7 +1577,12 @@ def add_entries_from_cat(self, round_id, cat_name):
15691577
return entries
15701578

15711579
def add_entries_by_name(self, round_id, file_names):
1572-
rnd = self.user_dao.get_round(round_id)
1580+
try:
1581+
rnd = self.user_dao.get_round(round_id)
1582+
except Exception as e:
1583+
logger.error("Round not found: %s", round_id)
1584+
raise InvalidAction("Round not found")
1585+
15731586
if ENV_NAME == 'dev':
15741587
source = 'remote'
15751588
else:

0 commit comments

Comments
 (0)