fix(error): don't return in a finally block (PEP-765) (#35610)

https://docs.python.org/3/whatsnew/3.14.html#pep-765-control-flow-in-finally-blocks

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2026-01-05 12:11:16 +05:30 committed by GitHub
parent 489f5fbfb9
commit f8443020ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,9 +109,10 @@ def get_error_metadata() -> str:
metadata["form_dict"] = sanitized_dict(frappe.form_dict)
metadata["user"] = getattr(frappe.session, "user", "Unidentified")
finally:
except Exception:
# We don't want to bother with exception handling *while* gathering some error's metadata
return frappe.as_json(metadata) # noqa: B012
pass
return frappe.as_json(metadata)
def log_error_snapshot(exception: Exception):