From 91dce0b00799f48b421fc4a15a9e93bc7cf94b1a Mon Sep 17 00:00:00 2001 From: Akhil Narang Date: Wed, 20 Dec 2023 17:34:43 +0530 Subject: [PATCH] feat(sentry): drop events which have `frappe.throw` (#23886) Signed-off-by: Akhil Narang --- frappe/public/js/sentry.bundle.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frappe/public/js/sentry.bundle.js b/frappe/public/js/sentry.bundle.js index edef9bc363..9757595af4 100644 --- a/frappe/public/js/sentry.bundle.js +++ b/frappe/public/js/sentry.bundle.js @@ -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; + }, });