Ignore TanStack Query CancelledError in client error tracking (#524)
This commit is contained in:
parent
fcb35a8145
commit
044d712580
@ -20,12 +20,16 @@ type ExceptionEntry = {
|
|||||||
stacktrace?: { frames?: unknown[] };
|
stacktrace?: { frames?: unknown[] };
|
||||||
};
|
};
|
||||||
|
|
||||||
// Unactionable exceptions we don't want polluting error tracking. They share
|
// Unactionable exceptions we don't want polluting error tracking. Most share
|
||||||
// the trait of not being our code: browser extensions inject promise rejections
|
// the trait of not being our code: browser extensions inject promise rejections
|
||||||
// and cross-origin scripts surface as a detail-less "Script error.", while the
|
// and cross-origin scripts surface as a detail-less "Script error.", while the
|
||||||
// global onerror handler synthesizes a stackless "undefined" when it fires
|
// global onerror handler synthesizes a stackless "undefined" when it fires
|
||||||
// without a real Error object. Real app errors always carry a stack, so the
|
// without a real Error object. Real app errors always carry a stack, so the
|
||||||
// "undefined" rule is gated on synthetic + no frames to avoid false drops.
|
// "undefined" rule is gated on synthetic + no frames to avoid false drops.
|
||||||
|
// The rest are expected cancellations: TanStack Query throws "CancelledError"
|
||||||
|
// when a route load is abandoned mid-flight (navigating away), which is normal
|
||||||
|
// behavior, not a failure. Matched exactly so a real error that merely mentions
|
||||||
|
// cancellation still gets captured.
|
||||||
function isIgnorableException(
|
function isIgnorableException(
|
||||||
properties: Record<string, unknown> | undefined,
|
properties: Record<string, unknown> | undefined,
|
||||||
): boolean {
|
): boolean {
|
||||||
@ -36,6 +40,7 @@ function isIgnorableException(
|
|||||||
if (value.includes("Object Not Found Matching Id")) return true;
|
if (value.includes("Object Not Found Matching Id")) return true;
|
||||||
if (value === "Script error.") return true;
|
if (value === "Script error.") return true;
|
||||||
if (value.includes("signal is aborted without reason")) return true;
|
if (value.includes("signal is aborted without reason")) return true;
|
||||||
|
if (value === "CancelledError") return true;
|
||||||
const frames = entry?.stacktrace?.frames;
|
const frames = entry?.stacktrace?.frames;
|
||||||
return (
|
return (
|
||||||
value === "undefined" &&
|
value === "undefined" &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user