feat(sentry): log request json body / form data

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2024-01-02 11:39:16 +05:30
parent b71d01e1b4
commit da8e88e66c
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -116,6 +116,10 @@ def capture_exception(message: str | None = None) -> None:
set_scope(scope)
evt_processor = _make_wsgi_event_processor(frappe.request.environ, False)
scope.add_event_processor(evt_processor)
if frappe.request.is_json:
scope.set_context("JSON Body", frappe.request.json)
elif frappe.request.form:
scope.set_context("Form Data", frappe.request.form)
if client := hub.client:
exc_info = sys.exc_info()