@tracelog/lib 3.2.0-rc.123.9 → 3.3.0-rc.124.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -264,7 +264,7 @@ const Ft = () => {
264
264
  default:
265
265
  return ze;
266
266
  }
267
- }, Jt = 50, Zt = "3.2.0", es = Zt, ts = () => typeof window < "u" && typeof sessionStorage < "u", ss = () => {
267
+ }, Jt = 50, Zt = "3.3.0", es = Zt, ts = () => typeof window < "u" && typeof sessionStorage < "u", ss = () => {
268
268
  try {
269
269
  const n = new URLSearchParams(window.location.search);
270
270
  n.delete(nt);
@@ -3815,7 +3815,7 @@ class ne extends T {
3815
3815
  handleError = (e) => {
3816
3816
  if (!this.shouldSample())
3817
3817
  return;
3818
- const t = this.sanitize(e.message || "Unknown error");
3818
+ const t = this.sanitizeMessage(e.message, "Unknown error");
3819
3819
  if (this.shouldSuppressError(x.JS_ERROR, t) || this.shouldThrottleBySignature({
3820
3820
  message: t,
3821
3821
  filename: e.filename,
@@ -3844,7 +3844,7 @@ class ne extends T {
3844
3844
  handleRejection = (e) => {
3845
3845
  if (!this.shouldSample())
3846
3846
  return;
3847
- const t = this.extractRejectionMessage(e.reason), s = this.sanitize(t);
3847
+ const t = this.extractRejectionMessage(e.reason), s = this.sanitizeMessage(t, "Unknown rejection");
3848
3848
  if (this.shouldSuppressError(x.PROMISE_REJECTION, s) || this.shouldThrottleBySignature({ message: s }))
3849
3849
  return;
3850
3850
  const r = e.reason instanceof Error && typeof e.reason.stack == "string" ? this.truncateStack(e.reason.stack) : void 0, i = e.reason instanceof Error && e.reason.name !== "Error" ? e.reason.name : void 0;
@@ -3875,6 +3875,17 @@ class ne extends T {
3875
3875
  const t = e.length > je ? e.slice(0, je) + "..." : e;
3876
3876
  return U(t);
3877
3877
  }
3878
+ /**
3879
+ * Sanitizes an error message and guarantees a non-empty result.
3880
+ *
3881
+ * An empty `error_data.message` (from a `Promise.reject('')`, `new Error('')`,
3882
+ * or `{ message: '' }` reason — all of which stringify to '') is rejected by
3883
+ * the ingestion DTO, which 400s the whole batch and drops the co-traveling
3884
+ * events. Every error path must fall back to a non-empty placeholder.
3885
+ */
3886
+ sanitizeMessage(e, t) {
3887
+ return this.sanitize(e) || t;
3888
+ }
3878
3889
  shouldSuppressError(e, t) {
3879
3890
  const s = Date.now(), r = `${e}:${t}`, i = this.recentErrors.get(r);
3880
3891
  return i !== void 0 && s - i < We ? (this.recentErrors.set(r, s), !0) : (this.recentErrors.set(r, s), this.recentErrors.size > Bt ? (this.recentErrors.clear(), this.recentErrors.set(r, s), !1) : (this.recentErrors.size > q && this.pruneOldErrors(), !1));