From 983d0ebaaf56a6bf1df437c535cf9ce57f2338ac Mon Sep 17 00:00:00 2001 From: Mike Yavorsky Date: Tue, 14 Nov 2023 20:19:07 -0500 Subject: [PATCH] | catch mixpanel error --- backend/routes/incidents.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/routes/incidents.py b/backend/routes/incidents.py index 816774e90..10be67b10 100644 --- a/backend/routes/incidents.py +++ b/backend/routes/incidents.py @@ -81,6 +81,7 @@ def search_incidents(): """Search Incidents.""" body: SearchIncidentsSchema = request.context.json query = db.session.query(Incident) + logger = logging.getLogger('incidents') try: if body.location: @@ -109,12 +110,15 @@ def search_incidents(): page=body.page, per_page=body.perPage, max_per_page=100 ) - track_to_mp(request, "search_incidents", { - "description": body.description, - "location": body.location, - "dateStart": body.dateStart, - "dateEnd": body.dateEnd, - }) + try: + track_to_mp(request, "search_incidents", { + "description": body.description, + "location": body.location, + "dateStart": body.dateStart, + "dateEnd": body.dateEnd, + }) + except MixpanelException as e: + logger.error(e); try: return {