Skip to content

Commit

Permalink
Add exception handling for missing portfolio in list analysis (#996)
Browse files Browse the repository at this point in the history
* Add exception handling for missing portfolio in list analysis

* update image tag
  • Loading branch information
sambles authored Mar 18, 2024
1 parent 5882801 commit 97fb1d1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.1
2.3.2rc2
9 changes: 8 additions & 1 deletion src/server/oasisapi/analyses/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import absolute_import, print_function
import logging

from celery.result import AsyncResult
from django.conf import settings as django_settings
Expand Down Expand Up @@ -308,7 +309,13 @@ def get_absolute_chunking_configuration_url(self, request=None, namespace=None):

def get_groups(self):
groups = []
portfolio_groups = self.portfolio.groups.all()
try:
portfolio_groups = self.portfolio.groups.all()
except Portfolio.DoesNotExist as e:
portfolio_groups = []
logger = logging.getLogger(__name__)
logger.exception(f"Analyses ID: {self.id} portfolio not found, {e}")

for group in portfolio_groups:
groups.append(group.name)
return groups
Expand Down

0 comments on commit 97fb1d1

Please sign in to comment.