summaryrefslogtreecommitdiff
path: root/ext/web/lib.deno_web.d.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2022-04-19 09:59:51 +0100
committerGitHub <noreply@github.com>2022-04-19 10:59:51 +0200
commitc30d95f2e36cb3519e1e23c0934b388ebba6bc2c (patch)
treef34db42cce4803e76affb12ccb95ad59a77354ad /ext/web/lib.deno_web.d.ts
parenta64e63c3614b98aa2b51fb6b7ef4e30251e03111 (diff)
feat(ext/web): add globalThis.reportError() (#13799)
Diffstat (limited to 'ext/web/lib.deno_web.d.ts')
-rw-r--r--ext/web/lib.deno_web.d.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/ext/web/lib.deno_web.d.ts b/ext/web/lib.deno_web.d.ts
index 77c502fac..8c845ced1 100644
--- a/ext/web/lib.deno_web.d.ts
+++ b/ext/web/lib.deno_web.d.ts
@@ -890,3 +890,22 @@ declare class DecompressionStream {
readonly readable: ReadableStream<Uint8Array>;
readonly writable: WritableStream<Uint8Array>;
}
+
+/** Dispatch an uncaught exception. Similar to a synchronous version of:
+ * ```ts
+ * setTimeout(() => { throw error; }, 0);
+ * ```
+ * The error can not be caught with a `try/catch` block. An error event will
+ * be dispatched to the global scope. You can prevent the error from being
+ * reported to the console with `Event.prototype.preventDefault()`:
+ * ```ts
+ * addEventListener("error", (event) => {
+ * event.preventDefault();
+ * });
+ * reportError(new Error("foo")); // Will not be reported.
+ * ```
+ * In Deno, this error will terminate the process if not intercepted like above.
+ */
+declare function reportError(
+ error: any,
+): void;