summaryrefslogtreecommitdiff
path: root/cli/js/event_target.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-02-21 10:36:13 -0500
committerGitHub <noreply@github.com>2020-02-21 10:36:13 -0500
commitdd8a10948195f231a6a9eb652e3f208813904ad6 (patch)
treef9a4afeb67bbead882c29c2458a5f1f99e2e42db /cli/js/event_target.ts
parentd9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff)
refactor: remove unneeded ErrorKinds (#3936)
Diffstat (limited to 'cli/js/event_target.ts')
-rw-r--r--cli/js/event_target.ts19
1 files changed, 9 insertions, 10 deletions
diff --git a/cli/js/event_target.ts b/cli/js/event_target.ts
index 495c8a042..daa73eb23 100644
--- a/cli/js/event_target.ts
+++ b/cli/js/event_target.ts
@@ -1,6 +1,5 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import * as domTypes from "./dom_types.ts";
-import { DenoError, ErrorKind } from "./errors.ts";
import { hasOwnProperty, requiredArguments } from "./util.ts";
import {
getRoot,
@@ -134,17 +133,15 @@ export class EventTarget implements domTypes.EventTarget {
}
if (event.dispatched || !event.initialized) {
- throw new DenoError(
- ErrorKind.InvalidData,
- "Tried to dispatch an uninitialized event"
- );
+ // TODO(bartlomieju): very likely that different error
+ // should be thrown here (DOMException?)
+ throw new TypeError("Tried to dispatch an uninitialized event");
}
if (event.eventPhase !== domTypes.EventPhase.NONE) {
- throw new DenoError(
- ErrorKind.InvalidData,
- "Tried to dispatch a dispatching event"
- );
+ // TODO(bartlomieju): very likely that different error
+ // should be thrown here (DOMException?)
+ throw new TypeError("Tried to dispatch a dispatching event");
}
return eventTargetHelpers.dispatch(this_, event);
@@ -418,7 +415,9 @@ const eventTargetHelpers = {
try {
listener.handleEvent(eventImpl);
} catch (error) {
- throw new DenoError(ErrorKind.Interrupted, error.message);
+ // TODO(bartlomieju): very likely that different error
+ // should be thrown here (DOMException?)
+ throw new Error(error.message);
}
eventImpl.inPassiveListener = false;