From c34621b634df82dcc66f1ddeafb40fbe7eab1118 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 18 Apr 2022 17:27:12 -0700 Subject: web: partially handle CSL author missing path --- python/fatcat_web/routes.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py index 1f6602d4..e2c90d52 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 ( @@ -1468,7 +1469,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(500, e) try: cite = citeproc_csl(csl, style, is_html) except citeproc_styles.StyleNotFoundError as e: -- cgit v1.2.3