summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 1f6602d4..4ceeac49 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -3,6 +3,7 @@ import os
from typing import Any, Callable, Dict, List, Optional
import citeproc_styles
+import sentry_sdk
from fatcat_openapi_client import EditgroupAnnotation
from fatcat_openapi_client.rest import ApiException, ApiValueError
from flask import (
@@ -1450,7 +1451,14 @@ def release_bibtex(ident: str) -> AnyResponse:
entity = api.get_release(ident)
except ApiException as ae:
raise ae
- csl = release_to_csl(entity)
+ try:
+ csl = release_to_csl(entity)
+ except ValueError as e:
+ # "handle" the missing author/surname path, so we don't get exception
+ # reports about it. these are not linked to, only show up from bots.
+ sentry_sdk.set_level("warning")
+ sentry_sdk.capture_exception(e)
+ abort(400, e)
bibtex = citeproc_csl(csl, "bibtex")
return Response(bibtex, mimetype="text/plain")
@@ -1468,7 +1476,14 @@ def release_citeproc(ident: str) -> AnyResponse:
entity = api.get_release(ident)
except ApiException as ae:
raise ae
- csl = release_to_csl(entity)
+ try:
+ csl = release_to_csl(entity)
+ except ValueError as e:
+ # "handle" the missing author/surname path, so we don't get exception
+ # reports about it. these are not linked to, only show up from bots.
+ sentry_sdk.set_level("warning")
+ sentry_sdk.capture_exception(e)
+ abort(400, e)
try:
cite = citeproc_csl(csl, style, is_html)
except citeproc_styles.StyleNotFoundError as e: