We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Falcon sentry integration catch all http errors
Hi,
seems that the falcon integration catches all the http errors and not just the 500 http error code as the documentation says, https://docs.sentry.io/platforms/python/falcon/#behavior

https://github.com/getsentry/sentry-python/blob/7d482b5bfa1d4f58eb090818496eba8fee8e63aa/sentry_sdk/integrations/falcon.py#L156

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `sentry_sdk/integrations/falcon.py`
Content:
```
1 from __future__ import absolute_import
2 
3 from sentry_sdk.hub import Hub
4 from sentry_sdk.integrations import Integration, DidNotEnable
5 from sentry_sdk.integrations._wsgi_common import RequestExtractor
6 from sentry_sdk.integrations.wsgi import SentryWsgiMiddleware
7 from sentry_sdk.utils import capture_internal_exceptions, event_from_exception
8 
9 from sentry_sdk._types import MYPY
10 
11 if MYPY:
12     from typing import Any
13     from typing import Dict
14     from typing import Optional
15 
16     from sentry_sdk._types import EventProcessor
17 
18 try:
19     import falcon  # type: ignore
20     import falcon.api_helpers  # type: ignore
21 
22     from falcon import __version__ as FALCON_VERSION
23 except ImportError:
24     raise DidNotEnable("Falcon not installed")
25 
26 
27 class FalconRequestExtractor(RequestExtractor):
28     def env(self):
29         # type: () -> Dict[str, Any]
30         return self.request.env
31 
32     def cookies(self):
33         # type: () -> Dict[str, Any]
34         return self.request.cookies
35 
36     def form(self):
37         # type: () -> None
38         return None  # No such concept in Falcon
39 
40     def files(self):
41         # type: () -> None
42         return None  # No such concept in Falcon
43 
44     def raw_data(self):
45         # type: () -> Optional[str]
46 
47         # As request data can only be read once we won't make this available
48         # to Sentry. Just send back a dummy string in case there was a
49         # content length.
50         # TODO(jmagnusson): Figure out if there's a way to support this
51         content_length = self.content_length()
52         if content_length > 0:
53             return "[REQUEST_CONTAINING_RAW_DATA]"
54         else:
55             return None
56 
57     def json(self):
58         # type: () -> Optional[Dict[str, Any]]
59         try:
60             return self.request.media
61         except falcon.errors.HTTPBadRequest:
62             # NOTE(jmagnusson): We return `falcon.Request._media` here because
63             # falcon 1.4 doesn't do proper type checking in
64             # `falcon.Request.media`. This has been fixed in 2.0.
65             # Relevant code: https://github.com/falconry/falcon/blob/1.4.1/falcon/request.py#L953
66             return self.request._media
67 
68 
69 class SentryFalconMiddleware(object):
70     """Captures exceptions in Falcon requests and send to Sentry"""
71 
72     def process_request(self, req, resp, *args, **kwargs):
73         # type: (Any, Any, *Any, **Any) -> None
74         hub = Hub.current
75         integration = hub.get_integration(FalconIntegration)
76         if integration is None:
77             return
78 
79         with hub.configure_scope() as scope:
80             scope._name = "falcon"
81             scope.add_event_processor(_make_request_event_processor(req, integration))
82 
83 
84 TRANSACTION_STYLE_VALUES = ("uri_template", "path")
85 
86 
87 class FalconIntegration(Integration):
88     identifier = "falcon"
89 
90     transaction_style = None
91 
92     def __init__(self, transaction_style="uri_template"):
93         # type: (str) -> None
94         if transaction_style not in TRANSACTION_STYLE_VALUES:
95             raise ValueError(
96                 "Invalid value for transaction_style: %s (must be in %s)"
97                 % (transaction_style, TRANSACTION_STYLE_VALUES)
98             )
99         self.transaction_style = transaction_style
100 
101     @staticmethod
102     def setup_once():
103         # type: () -> None
104         try:
105             version = tuple(map(int, FALCON_VERSION.split(".")))
106         except (ValueError, TypeError):
107             raise DidNotEnable("Unparsable Falcon version: {}".format(FALCON_VERSION))
108 
109         if version < (1, 4):
110             raise DidNotEnable("Falcon 1.4 or newer required.")
111 
112         _patch_wsgi_app()
113         _patch_handle_exception()
114         _patch_prepare_middleware()
115 
116 
117 def _patch_wsgi_app():
118     # type: () -> None
119     original_wsgi_app = falcon.API.__call__
120 
121     def sentry_patched_wsgi_app(self, env, start_response):
122         # type: (falcon.API, Any, Any) -> Any
123         hub = Hub.current
124         integration = hub.get_integration(FalconIntegration)
125         if integration is None:
126             return original_wsgi_app(self, env, start_response)
127 
128         sentry_wrapped = SentryWsgiMiddleware(
129             lambda envi, start_resp: original_wsgi_app(self, envi, start_resp)
130         )
131 
132         return sentry_wrapped(env, start_response)
133 
134     falcon.API.__call__ = sentry_patched_wsgi_app
135 
136 
137 def _patch_handle_exception():
138     # type: () -> None
139     original_handle_exception = falcon.API._handle_exception
140 
141     def sentry_patched_handle_exception(self, *args):
142         # type: (falcon.API, *Any) -> Any
143         # NOTE(jmagnusson): falcon 2.0 changed falcon.API._handle_exception
144         # method signature from `(ex, req, resp, params)` to
145         # `(req, resp, ex, params)`
146         if isinstance(args[0], Exception):
147             ex = args[0]
148         else:
149             ex = args[2]
150 
151         was_handled = original_handle_exception(self, *args)
152 
153         hub = Hub.current
154         integration = hub.get_integration(FalconIntegration)
155 
156         if integration is not None and not _is_falcon_http_error(ex):
157             # If an integration is there, a client has to be there.
158             client = hub.client  # type: Any
159 
160             event, hint = event_from_exception(
161                 ex,
162                 client_options=client.options,
163                 mechanism={"type": "falcon", "handled": False},
164             )
165             hub.capture_event(event, hint=hint)
166 
167         return was_handled
168 
169     falcon.API._handle_exception = sentry_patched_handle_exception
170 
171 
172 def _patch_prepare_middleware():
173     # type: () -> None
174     original_prepare_middleware = falcon.api_helpers.prepare_middleware
175 
176     def sentry_patched_prepare_middleware(
177         middleware=None, independent_middleware=False
178     ):
179         # type: (Any, Any) -> Any
180         hub = Hub.current
181         integration = hub.get_integration(FalconIntegration)
182         if integration is not None:
183             middleware = [SentryFalconMiddleware()] + (middleware or [])
184         return original_prepare_middleware(middleware, independent_middleware)
185 
186     falcon.api_helpers.prepare_middleware = sentry_patched_prepare_middleware
187 
188 
189 def _is_falcon_http_error(ex):
190     # type: (BaseException) -> bool
191     return isinstance(ex, (falcon.HTTPError, falcon.http_status.HTTPStatus))
192 
193 
194 def _make_request_event_processor(req, integration):
195     # type: (falcon.Request, FalconIntegration) -> EventProcessor
196 
197     def inner(event, hint):
198         # type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]
199         if integration.transaction_style == "uri_template":
200             event["transaction"] = req.uri_template
201         elif integration.transaction_style == "path":
202             event["transaction"] = req.path
203 
204         with capture_internal_exceptions():
205             FalconRequestExtractor(req).extract_into_event(event)
206 
207         return event
208 
209     return inner
210
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/sentry_sdk/integrations/falcon.py b/sentry_sdk/integrations/falcon.py
--- a/sentry_sdk/integrations/falcon.py
+++ b/sentry_sdk/integrations/falcon.py
@@ -153,7 +153,7 @@
         hub = Hub.current
         integration = hub.get_integration(FalconIntegration)
 
-        if integration is not None and not _is_falcon_http_error(ex):
+        if integration is not None and _exception_leads_to_http_5xx(ex):
             # If an integration is there, a client has to be there.
             client = hub.client  # type: Any
 
@@ -186,9 +186,15 @@
     falcon.api_helpers.prepare_middleware = sentry_patched_prepare_middleware
 
 
-def _is_falcon_http_error(ex):
-    # type: (BaseException) -> bool
-    return isinstance(ex, (falcon.HTTPError, falcon.http_status.HTTPStatus))
+def _exception_leads_to_http_5xx(ex):
+    # type: (Exception) -> bool
+    is_server_error = isinstance(ex, falcon.HTTPError) and (ex.status or "").startswith(
+        "5"
+    )
+    is_unhandled_error = not isinstance(
+        ex, (falcon.HTTPError, falcon.http_status.HTTPStatus)
+    )
+    return is_server_error or is_unhandled_error
 
 
 def _make_request_event_processor(req, integration):

{"golden_diff": "diff --git a/sentry_sdk/integrations/falcon.py b/sentry_sdk/integrations/falcon.py\n--- a/sentry_sdk/integrations/falcon.py\n+++ b/sentry_sdk/integrations/falcon.py\n@@ -153,7 +153,7 @@\n         hub = Hub.current\n         integration = hub.get_integration(FalconIntegration)\n \n-        if integration is not None and not _is_falcon_http_error(ex):\n+        if integration is not None and _exception_leads_to_http_5xx(ex):\n             # If an integration is there, a client has to be there.\n             client = hub.client  # type: Any\n \n@@ -186,9 +186,15 @@\n     falcon.api_helpers.prepare_middleware = sentry_patched_prepare_middleware\n \n \n-def _is_falcon_http_error(ex):\n-    # type: (BaseException) -> bool\n-    return isinstance(ex, (falcon.HTTPError, falcon.http_status.HTTPStatus))\n+def _exception_leads_to_http_5xx(ex):\n+    # type: (Exception) -> bool\n+    is_server_error = isinstance(ex, falcon.HTTPError) and (ex.status or \"\").startswith(\n+        \"5\"\n+    )\n+    is_unhandled_error = not isinstance(\n+        ex, (falcon.HTTPError, falcon.http_status.HTTPStatus)\n+    )\n+    return is_server_error or is_unhandled_error\n \n \n def _make_request_event_processor(req, integration):\n", "issue": "Falcon sentry integration catch all http errors\nHi,\r\nseems that the falcon integration catches all the http errors and not just the 500 http error code as the documentation says, https://docs.sentry.io/platforms/python/falcon/#behavior\r\n\r\nhttps://github.com/getsentry/sentry-python/blob/7d482b5bfa1d4f58eb090818496eba8fee8e63aa/sentry_sdk/integrations/falcon.py#L156\n", "before_files": [{"content": "from __future__ import absolute_import\n\nfrom sentry_sdk.hub import Hub\nfrom sentry_sdk.integrations import Integration, DidNotEnable\nfrom sentry_sdk.integrations._wsgi_common import RequestExtractor\nfrom sentry_sdk.integrations.wsgi import SentryWsgiMiddleware\nfrom sentry_sdk.utils import capture_internal_exceptions, event_from_exception\n\nfrom sentry_sdk._types import MYPY\n\nif MYPY:\n    from typing import Any\n    from typing import Dict\n    from typing import Optional\n\n    from sentry_sdk._types import EventProcessor\n\ntry:\n    import falcon  # type: ignore\n    import falcon.api_helpers  # type: ignore\n\n    from falcon import __version__ as FALCON_VERSION\nexcept ImportError:\n    raise DidNotEnable(\"Falcon not installed\")\n\n\nclass FalconRequestExtractor(RequestExtractor):\n    def env(self):\n        # type: () -> Dict[str, Any]\n        return self.request.env\n\n    def cookies(self):\n        # type: () -> Dict[str, Any]\n        return self.request.cookies\n\n    def form(self):\n        # type: () -> None\n        return None  # No such concept in Falcon\n\n    def files(self):\n        # type: () -> None\n        return None  # No such concept in Falcon\n\n    def raw_data(self):\n        # type: () -> Optional[str]\n\n        # As request data can only be read once we won't make this available\n        # to Sentry. Just send back a dummy string in case there was a\n        # content length.\n        # TODO(jmagnusson): Figure out if there's a way to support this\n        content_length = self.content_length()\n        if content_length > 0:\n            return \"[REQUEST_CONTAINING_RAW_DATA]\"\n        else:\n            return None\n\n    def json(self):\n        # type: () -> Optional[Dict[str, Any]]\n        try:\n            return self.request.media\n        except falcon.errors.HTTPBadRequest:\n            # NOTE(jmagnusson): We return `falcon.Request._media` here because\n            # falcon 1.4 doesn't do proper type checking in\n            # `falcon.Request.media`. This has been fixed in 2.0.\n            # Relevant code: https://github.com/falconry/falcon/blob/1.4.1/falcon/request.py#L953\n            return self.request._media\n\n\nclass SentryFalconMiddleware(object):\n    \"\"\"Captures exceptions in Falcon requests and send to Sentry\"\"\"\n\n    def process_request(self, req, resp, *args, **kwargs):\n        # type: (Any, Any, *Any, **Any) -> None\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n        if integration is None:\n            return\n\n        with hub.configure_scope() as scope:\n            scope._name = \"falcon\"\n            scope.add_event_processor(_make_request_event_processor(req, integration))\n\n\nTRANSACTION_STYLE_VALUES = (\"uri_template\", \"path\")\n\n\nclass FalconIntegration(Integration):\n    identifier = \"falcon\"\n\n    transaction_style = None\n\n    def __init__(self, transaction_style=\"uri_template\"):\n        # type: (str) -> None\n        if transaction_style not in TRANSACTION_STYLE_VALUES:\n            raise ValueError(\n                \"Invalid value for transaction_style: %s (must be in %s)\"\n                % (transaction_style, TRANSACTION_STYLE_VALUES)\n            )\n        self.transaction_style = transaction_style\n\n    @staticmethod\n    def setup_once():\n        # type: () -> None\n        try:\n            version = tuple(map(int, FALCON_VERSION.split(\".\")))\n        except (ValueError, TypeError):\n            raise DidNotEnable(\"Unparsable Falcon version: {}\".format(FALCON_VERSION))\n\n        if version < (1, 4):\n            raise DidNotEnable(\"Falcon 1.4 or newer required.\")\n\n        _patch_wsgi_app()\n        _patch_handle_exception()\n        _patch_prepare_middleware()\n\n\ndef _patch_wsgi_app():\n    # type: () -> None\n    original_wsgi_app = falcon.API.__call__\n\n    def sentry_patched_wsgi_app(self, env, start_response):\n        # type: (falcon.API, Any, Any) -> Any\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n        if integration is None:\n            return original_wsgi_app(self, env, start_response)\n\n        sentry_wrapped = SentryWsgiMiddleware(\n            lambda envi, start_resp: original_wsgi_app(self, envi, start_resp)\n        )\n\n        return sentry_wrapped(env, start_response)\n\n    falcon.API.__call__ = sentry_patched_wsgi_app\n\n\ndef _patch_handle_exception():\n    # type: () -> None\n    original_handle_exception = falcon.API._handle_exception\n\n    def sentry_patched_handle_exception(self, *args):\n        # type: (falcon.API, *Any) -> Any\n        # NOTE(jmagnusson): falcon 2.0 changed falcon.API._handle_exception\n        # method signature from `(ex, req, resp, params)` to\n        # `(req, resp, ex, params)`\n        if isinstance(args[0], Exception):\n            ex = args[0]\n        else:\n            ex = args[2]\n\n        was_handled = original_handle_exception(self, *args)\n\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n\n        if integration is not None and not _is_falcon_http_error(ex):\n            # If an integration is there, a client has to be there.\n            client = hub.client  # type: Any\n\n            event, hint = event_from_exception(\n                ex,\n                client_options=client.options,\n                mechanism={\"type\": \"falcon\", \"handled\": False},\n            )\n            hub.capture_event(event, hint=hint)\n\n        return was_handled\n\n    falcon.API._handle_exception = sentry_patched_handle_exception\n\n\ndef _patch_prepare_middleware():\n    # type: () -> None\n    original_prepare_middleware = falcon.api_helpers.prepare_middleware\n\n    def sentry_patched_prepare_middleware(\n        middleware=None, independent_middleware=False\n    ):\n        # type: (Any, Any) -> Any\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n        if integration is not None:\n            middleware = [SentryFalconMiddleware()] + (middleware or [])\n        return original_prepare_middleware(middleware, independent_middleware)\n\n    falcon.api_helpers.prepare_middleware = sentry_patched_prepare_middleware\n\n\ndef _is_falcon_http_error(ex):\n    # type: (BaseException) -> bool\n    return isinstance(ex, (falcon.HTTPError, falcon.http_status.HTTPStatus))\n\n\ndef _make_request_event_processor(req, integration):\n    # type: (falcon.Request, FalconIntegration) -> EventProcessor\n\n    def inner(event, hint):\n        # type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]\n        if integration.transaction_style == \"uri_template\":\n            event[\"transaction\"] = req.uri_template\n        elif integration.transaction_style == \"path\":\n            event[\"transaction\"] = req.path\n\n        with capture_internal_exceptions():\n            FalconRequestExtractor(req).extract_into_event(event)\n\n        return event\n\n    return inner\n", "path": "sentry_sdk/integrations/falcon.py"}], "after_files": [{"content": "from __future__ import absolute_import\n\nfrom sentry_sdk.hub import Hub\nfrom sentry_sdk.integrations import Integration, DidNotEnable\nfrom sentry_sdk.integrations._wsgi_common import RequestExtractor\nfrom sentry_sdk.integrations.wsgi import SentryWsgiMiddleware\nfrom sentry_sdk.utils import capture_internal_exceptions, event_from_exception\n\nfrom sentry_sdk._types import MYPY\n\nif MYPY:\n    from typing import Any\n    from typing import Dict\n    from typing import Optional\n\n    from sentry_sdk._types import EventProcessor\n\ntry:\n    import falcon  # type: ignore\n    import falcon.api_helpers  # type: ignore\n\n    from falcon import __version__ as FALCON_VERSION\nexcept ImportError:\n    raise DidNotEnable(\"Falcon not installed\")\n\n\nclass FalconRequestExtractor(RequestExtractor):\n    def env(self):\n        # type: () -> Dict[str, Any]\n        return self.request.env\n\n    def cookies(self):\n        # type: () -> Dict[str, Any]\n        return self.request.cookies\n\n    def form(self):\n        # type: () -> None\n        return None  # No such concept in Falcon\n\n    def files(self):\n        # type: () -> None\n        return None  # No such concept in Falcon\n\n    def raw_data(self):\n        # type: () -> Optional[str]\n\n        # As request data can only be read once we won't make this available\n        # to Sentry. Just send back a dummy string in case there was a\n        # content length.\n        # TODO(jmagnusson): Figure out if there's a way to support this\n        content_length = self.content_length()\n        if content_length > 0:\n            return \"[REQUEST_CONTAINING_RAW_DATA]\"\n        else:\n            return None\n\n    def json(self):\n        # type: () -> Optional[Dict[str, Any]]\n        try:\n            return self.request.media\n        except falcon.errors.HTTPBadRequest:\n            # NOTE(jmagnusson): We return `falcon.Request._media` here because\n            # falcon 1.4 doesn't do proper type checking in\n            # `falcon.Request.media`. This has been fixed in 2.0.\n            # Relevant code: https://github.com/falconry/falcon/blob/1.4.1/falcon/request.py#L953\n            return self.request._media\n\n\nclass SentryFalconMiddleware(object):\n    \"\"\"Captures exceptions in Falcon requests and send to Sentry\"\"\"\n\n    def process_request(self, req, resp, *args, **kwargs):\n        # type: (Any, Any, *Any, **Any) -> None\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n        if integration is None:\n            return\n\n        with hub.configure_scope() as scope:\n            scope._name = \"falcon\"\n            scope.add_event_processor(_make_request_event_processor(req, integration))\n\n\nTRANSACTION_STYLE_VALUES = (\"uri_template\", \"path\")\n\n\nclass FalconIntegration(Integration):\n    identifier = \"falcon\"\n\n    transaction_style = None\n\n    def __init__(self, transaction_style=\"uri_template\"):\n        # type: (str) -> None\n        if transaction_style not in TRANSACTION_STYLE_VALUES:\n            raise ValueError(\n                \"Invalid value for transaction_style: %s (must be in %s)\"\n                % (transaction_style, TRANSACTION_STYLE_VALUES)\n            )\n        self.transaction_style = transaction_style\n\n    @staticmethod\n    def setup_once():\n        # type: () -> None\n        try:\n            version = tuple(map(int, FALCON_VERSION.split(\".\")))\n        except (ValueError, TypeError):\n            raise DidNotEnable(\"Unparsable Falcon version: {}\".format(FALCON_VERSION))\n\n        if version < (1, 4):\n            raise DidNotEnable(\"Falcon 1.4 or newer required.\")\n\n        _patch_wsgi_app()\n        _patch_handle_exception()\n        _patch_prepare_middleware()\n\n\ndef _patch_wsgi_app():\n    # type: () -> None\n    original_wsgi_app = falcon.API.__call__\n\n    def sentry_patched_wsgi_app(self, env, start_response):\n        # type: (falcon.API, Any, Any) -> Any\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n        if integration is None:\n            return original_wsgi_app(self, env, start_response)\n\n        sentry_wrapped = SentryWsgiMiddleware(\n            lambda envi, start_resp: original_wsgi_app(self, envi, start_resp)\n        )\n\n        return sentry_wrapped(env, start_response)\n\n    falcon.API.__call__ = sentry_patched_wsgi_app\n\n\ndef _patch_handle_exception():\n    # type: () -> None\n    original_handle_exception = falcon.API._handle_exception\n\n    def sentry_patched_handle_exception(self, *args):\n        # type: (falcon.API, *Any) -> Any\n        # NOTE(jmagnusson): falcon 2.0 changed falcon.API._handle_exception\n        # method signature from `(ex, req, resp, params)` to\n        # `(req, resp, ex, params)`\n        if isinstance(args[0], Exception):\n            ex = args[0]\n        else:\n            ex = args[2]\n\n        was_handled = original_handle_exception(self, *args)\n\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n\n        if integration is not None and _exception_leads_to_http_5xx(ex):\n            # If an integration is there, a client has to be there.\n            client = hub.client  # type: Any\n\n            event, hint = event_from_exception(\n                ex,\n                client_options=client.options,\n                mechanism={\"type\": \"falcon\", \"handled\": False},\n            )\n            hub.capture_event(event, hint=hint)\n\n        return was_handled\n\n    falcon.API._handle_exception = sentry_patched_handle_exception\n\n\ndef _patch_prepare_middleware():\n    # type: () -> None\n    original_prepare_middleware = falcon.api_helpers.prepare_middleware\n\n    def sentry_patched_prepare_middleware(\n        middleware=None, independent_middleware=False\n    ):\n        # type: (Any, Any) -> Any\n        hub = Hub.current\n        integration = hub.get_integration(FalconIntegration)\n        if integration is not None:\n            middleware = [SentryFalconMiddleware()] + (middleware or [])\n        return original_prepare_middleware(middleware, independent_middleware)\n\n    falcon.api_helpers.prepare_middleware = sentry_patched_prepare_middleware\n\n\ndef _exception_leads_to_http_5xx(ex):\n    # type: (Exception) -> bool\n    is_server_error = isinstance(ex, falcon.HTTPError) and (ex.status or \"\").startswith(\n        \"5\"\n    )\n    is_unhandled_error = not isinstance(\n        ex, (falcon.HTTPError, falcon.http_status.HTTPStatus)\n    )\n    return is_server_error or is_unhandled_error\n\n\ndef _make_request_event_processor(req, integration):\n    # type: (falcon.Request, FalconIntegration) -> EventProcessor\n\n    def inner(event, hint):\n        # type: (Dict[str, Any], Dict[str, Any]) -> Dict[str, Any]\n        if integration.transaction_style == \"uri_template\":\n            event[\"transaction\"] = req.uri_template\n        elif integration.transaction_style == \"path\":\n            event[\"transaction\"] = req.path\n\n        with capture_internal_exceptions():\n            FalconRequestExtractor(req).extract_into_event(event)\n\n        return event\n\n    return inner\n", "path": "sentry_sdk/integrations/falcon.py"}]}