From f754ee1658d057c460525e7e86fd039d7ef6a89c Mon Sep 17 00:00:00 2001 From: burnettk Date: Mon, 2 Oct 2023 22:16:38 -0400 Subject: [PATCH] avoid notifying sentry on standard 405 method not allowed --- .../src/spiffworkflow_backend/exceptions/api_error.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py b/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py index f16ec493..39a3fd4e 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/exceptions/api_error.py @@ -27,6 +27,7 @@ from spiffworkflow_backend.services.authentication_service import TokenNotProvid from spiffworkflow_backend.services.authentication_service import UserNotLoggedInError from spiffworkflow_backend.services.task_service import TaskModelError from spiffworkflow_backend.services.task_service import TaskService +from werkzeug.exceptions import MethodNotAllowed api_error_blueprint = Blueprint("api_error_blueprint", __name__) @@ -247,6 +248,11 @@ def should_notify_sentry(exception: Exception) -> bool: return False if isinstance(exception, NotAuthorizedError): return False + + # like a 404, 405 Method Not Allowed: The method is not allowed for the requested URL + if isinstance(exception, MethodNotAllowed): + return False + return True