From e3f775e54f98257f4f4af51fa8fbd92de414758b Mon Sep 17 00:00:00 2001 From: burnettk Date: Sun, 1 Oct 2023 12:36:00 -0400 Subject: [PATCH] ignore process instance not found in terms of sentry notification --- spiffworkflow-backend/realmstuff/master-realm.json | 2 +- .../src/spiffworkflow_backend/exceptions/api_error.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/realmstuff/master-realm.json b/spiffworkflow-backend/realmstuff/master-realm.json index 85adca864..a4599dbd5 100644 --- a/spiffworkflow-backend/realmstuff/master-realm.json +++ b/spiffworkflow-backend/realmstuff/master-realm.json @@ -2001,4 +2001,4 @@ "clientPolicies" : { "policies" : [ ] } -} \ No newline at end of file +} diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py b/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py index 0e590c0e1..f16ec4938 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py @@ -234,7 +234,7 @@ def should_notify_sentry(exception: Exception) -> bool: """Determine if we should notify sentry. We want to capture_exception to log the exception to sentry, but we don't want to log: - 1. ApiErrors that are just invalid tokens + 1. ApiErrors that we expect to happen and that don't indicate bugs 2. NotAuthorizedError. we usually call check-permissions before calling an API to make sure we'll have access, but there are some cases where it's more convenient to just make the call from the frontend and handle the 403 appropriately. @@ -242,6 +242,9 @@ def should_notify_sentry(exception: Exception) -> bool: if isinstance(exception, ApiError): if exception.error_code == "invalid_token": return False + # when someone is looking for a process instance that doesn't exist or that they don't have access to + if exception.error_code == "process_instance_cannot_be_found": + return False if isinstance(exception, NotAuthorizedError): return False return True