feat(sentry): drop events which have frappe.throw (#23886)

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2023-12-20 17:34:43 +05:30 committed by GitHub
parent 3015852ce1
commit 91dce0b007
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -9,4 +9,15 @@ Sentry.init({
user: { id: frappe.boot.user.name ?? "Unidentified" },
tags: { site: frappe.boot.sitename },
},
beforeSend(event, hint) {
// Check if it was caused by frappe.throw()
if (
hint.originalException instanceof Error &&
hint.originalException.stack &&
hint.originalException.stack.includes("frappe.throw")
) {
return null;
}
return event;
},
});