Skip to content

Commit 91bf322

Browse files
orhanhenriksentrivana
andauthoredJan 31, 2025··
Handle MultiPartParserError to avoid internal sentry crash (#4001)
Handles an internal error in sentry_sdk if there is an issue with parsing request.POST. It would be better to handle this exception without request data instead of crashing and not reporting anything. --- Co-authored-by: Ivana Kellyer <[email protected]>
1 parent 8c25c73 commit 91bf322

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎sentry_sdk/integrations/_wsgi_common.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,15 @@ def form(self):
149149

150150
def parsed_body(self):
151151
# type: () -> Optional[Dict[str, Any]]
152-
form = self.form()
153-
files = self.files()
152+
try:
153+
form = self.form()
154+
except Exception:
155+
form = None
156+
try:
157+
files = self.files()
158+
except Exception:
159+
files = None
160+
154161
if form or files:
155162
data = {}
156163
if form:

0 commit comments

Comments
 (0)
Please sign in to comment.