diff options
author | Samuel Mannehed <samuel@cendio.se> | 2018-11-26 19:09:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-26 19:09:44 +0100 |
commit | 18439b0680811f175e39ce381d0faa138f868d3c (patch) | |
tree | 1b8ecc91c3b0fe777750da8f182ad3ae9d1dc622 /core | |
parent | 2bab9a0460d6095dc8548764d7e7bf02926115f1 (diff) | |
parent | 84a5a2d8270b67aedffe842305a56445dc436ad5 (diff) | |
download | novnc-18439b0680811f175e39ce381d0faa138f868d3c.tar.gz |
Merge pull request #1165 from juanjoDiaz/throw_errors_instead_of_strings
Throw Error instead of String
Diffstat (limited to 'core')
-rw-r--r-- | core/input/domkeytable.js | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/core/input/domkeytable.js b/core/input/domkeytable.js index d2109f3..60ae3f9 100644 --- a/core/input/domkeytable.js +++ b/core/input/domkeytable.js @@ -16,22 +16,22 @@ import KeyTable from "./keysym.js"; const DOMKeyTable = {}; function addStandard(key, standard) { - if (standard === undefined) throw "Undefined keysym for key \"" + key + "\""; - if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\""; + if (standard === undefined) throw new Error("Undefined keysym for key \"" + key + "\""); + if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\""); DOMKeyTable[key] = [standard, standard, standard, standard]; } function addLeftRight(key, left, right) { - if (left === undefined) throw "Undefined keysym for key \"" + key + "\""; - if (right === undefined) throw "Undefined keysym for key \"" + key + "\""; - if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\""; + if (left === undefined) throw new Error("Undefined keysym for key \"" + key + "\""); + if (right === undefined) throw new Error("Undefined keysym for key \"" + key + "\""); + if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\""); DOMKeyTable[key] = [left, left, right, left]; } function addNumpad(key, standard, numpad) { - if (standard === undefined) throw "Undefined keysym for key \"" + key + "\""; - if (numpad === undefined) throw "Undefined keysym for key \"" + key + "\""; - if (key in DOMKeyTable) throw "Duplicate entry for key \"" + key + "\""; + if (standard === undefined) throw new Error("Undefined keysym for key \"" + key + "\""); + if (numpad === undefined) throw new Error("Undefined keysym for key \"" + key + "\""); + if (key in DOMKeyTable) throw new Error("Duplicate entry for key \"" + key + "\""); DOMKeyTable[key] = [standard, standard, standard, numpad]; } |