summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAAGaming <aagaming@riseup.net>2024-06-27 00:07:55 -0400
committerAAGaming <aagaming@riseup.net>2024-06-27 00:07:55 -0400
commitfc52cf53ee674a11e4e68c880c93c8b2c07652da (patch)
treea5b5a969e6a546162e6fa6a968c14d9484a3dd3f
parentdcff7d146bfbe263ee21e4452f32776fe39e7a82 (diff)
downloaddecky-loader-fc52cf53ee674a11e4e68c880c93c8b2c07652da.tar.gz
decky-loader-fc52cf53ee674a11e4e68c880c93c8b2c07652da.zip
don't report errors to valve if we've caused one in the last 30 seconds
-rw-r--r--frontend/src/errorboundary-hook.tsx17
1 files changed, 15 insertions, 2 deletions
diff --git a/frontend/src/errorboundary-hook.tsx b/frontend/src/errorboundary-hook.tsx
index 4fb9b4e8..f7aadcbd 100644
--- a/frontend/src/errorboundary-hook.tsx
+++ b/frontend/src/errorboundary-hook.tsx
@@ -14,6 +14,7 @@ class ErrorBoundaryHook extends Logger {
private errorBoundaryPatch?: Patch;
private errorCheckPatch?: Patch;
public doNotReportErrors: boolean = false;
+ private disableReportingTimer: number = 0;
constructor() {
super('ErrorBoundaryHook');
@@ -53,8 +54,9 @@ class ErrorBoundaryHook extends Logger {
errorSource,
wasPlugin,
shouldReport,
- skipAllReporting: this.doNotReportErrors,
+ skipAllReporting: this.doNotReportErrors || this.disableReportingTimer,
});
+ if (!shouldReport) this.temporarilyDisableReporting();
// react#15069 workaround. this took 2 hours to figure out.
if (
args[0]?.message?.[3]?.[0] &&
@@ -64,7 +66,7 @@ class ErrorBoundaryHook extends Logger {
this.debug('ignoring early report caused by react#15069');
return true;
}
- if (this.doNotReportErrors) return true;
+ if (this.doNotReportErrors || this.disableReportingTimer) return true;
return shouldReport ? callOriginal : true;
});
@@ -92,6 +94,17 @@ class ErrorBoundaryHook extends Logger {
});
}
+ public temporarilyDisableReporting() {
+ this.debug("Reporting disabled for 30s due to a non-steam error.");
+ if (this.disableReportingTimer) {
+ clearTimeout(this.disableReportingTimer);
+ }
+ this.disableReportingTimer = setTimeout(() => {
+ this.debug("Reporting re-enabled after 30s timeout.");
+ this.disableReportingTimer = 0;
+ }, 30000)
+ }
+
deinit() {
this.errorCheckPatch?.unpatch();
this.errorBoundaryPatch?.unpatch();