Skip to content

Commit

Permalink
prevent 500 error on publications if datacite JSON can't be generated
Browse files Browse the repository at this point in the history
  • Loading branch information
jarosenb committed Mar 11, 2024
1 parent 46d483c commit 1fa9569
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion designsafe/apps/data/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,11 @@ def get_context_data(self, **kwargs):
context['hybrid_simulations'] = getattr(pub, 'hybrid_simulations',[])

proj = ProjectsManager(service_account()).get_project_by_id(pub.projectId)
context['dc_json'] = json.dumps(proj.to_dataset_json())
try:
context['dc_json'] = json.dumps(proj.to_dataset_json())
except Exception:
# If we can't generate DataCite JSON, render the page without meta tags.
pass

if self.request.user.is_authenticated:
context['angular_init'] = json.dumps({
Expand Down

0 comments on commit 1fa9569

Please sign in to comment.